Search code examples
javascriptgoogle-chromepluginsdetectdisconnect

Detect Disconnect plugin from javascript


A disconnect plugin in chrome is blocking social network widgets. And it's good. But it makes the page look odd for the visitor. Is there a way one could detect a failed social network plugin loading in javascript so it would be possible to hide the block altogether?


Solution

  • You can try something like this:

    dependencyAvailabilityCheckInterval = setInterval(doDependenciesExist, 500);
    
    function doDependenciesExist()
    {
        if(typeof FB !== 'undefined')
            return;
    
        alert("Looks like Facebook ist blocked!");
        // do rearranging or hiding of content
    }
    

    You could extend/replace typeof(FB) by any other js library you might need for your website or service.