How to check if an image was blocked by a browser extension?

Viewed 47

Following Scenario

How can I check if the images were blocked by an extension, so I can show the user fallback images?

Thanks for any advice.

1 Answers

I found a solution for the Facebook Container. I contacted the Instagram Widget Support and they were so kind to provide a solution:

const button = document.createElement('button');
button.classList.add('FacebookConnectButton');
button.style.display = 'none';
document.body.appendChild(button);
const observer = new MutationObserver((mutationList) => {
    if(button.classList.contains('fbc-has-badge')){
        // hide the iframe or show the instructions how to add exception to facebook container
    }
});
observer.observe(button, {attributes: true});

Works in my case!

Related