检测图像是否被代理阻止

发布于 2024-10-01 12:36:55 字数 92 浏览 1 评论 0原文

我有一个网页,里面有游戏。我意识到可以从学校访问(主要是因为我和我的朋友将使用它)。我希望查看特定图像是否被阻止并显示单独的内容,我知道我的学校特定代理不会阻止这些内容。

I have a webpage which has games on. I realize that there will be accessed from schools (mainly because me and my friends will be using it). I wish to see if a specific image is blocked and display seperate content, which i know isn't blocked by my schools specific proxy.

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

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

发布评论

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

评论(1

玩套路吗 2024-10-08 12:36:55

一种简单的方法是使用 JavaScript 在加载图像后对其进行测量。如果它没有图像的原始尺寸,则它已被阻止或更改。

当然,如果代理替换相同大小的内容,则这不起作用。

onerror 事件(您已经在标签中指出)也可能起作用,但它取决于代理。如果它只是发送一个空图像来代替每个被阻止的图像,则不会触发错误事件。

A simple way would be to use JavaScript to measure the image after it's been loaded. If it doesn't have the image's original dimensions, it's been blocked or altered.

This doesn't work if the Proxy substitutes content with the same size, though, of course.

The onerror event (that you are already pointing out in the tags) might work, too, but it will depend on the Proxy. If it just sends an empty image in place of every blocked one, the error event will not fire.

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