如何检查图像是否被浏览器扩展程序阻止?

发布于 2025-02-09 15:16:38 字数 608 浏览 2 评论 0 原文

以下情况下,

我该如何检查图像是否被扩展程序阻止,以便我可以显示用户后备图像?

感谢您的建议。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无法回应 2025-02-16 15:16:38

我找到了Facebook容器的解决方案。我联系了Instagram小部件支持,他们非常友善,可以提供解决方案:

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});

在我的情况下工作!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文