检测用户是否选择不在 IE 中显示不安全内容

发布于 2024-10-19 09:30:31 字数 355 浏览 2 评论 0原文

我有一个通过 https 提供的页面,在某些情况下可以显示通过 http 从机架空间拉取的图像。

在 IE 中,这会触发警告,询问用户是否要显示不安全的项目。

如果用户选择显示它们,那么一切都很好。但是,如果他们选择不显示它们,他们会发现页面看起来很损坏。

我正在尝试开发一种解决方案,如果用户选择隐藏它们,我会检测到这一点并弹出一个对话框,解释为什么页面看起来损坏以及他们需要做什么才能使其正常工作。

我尝试添加图像,通过 HTTP 加载并使用 onerror 事件调用对话框,但当图像被阻止时它不会触发。

我知道这首先不是一个理想的情况,这是一个最终会解决的问题,但与此同时,我知道如何检测用户选择了哪个选项吗?

I have a page served over https that in some instances can display images pulled from rackspace over http.

In IE this triggers a warning asking if the user would like to display the insecure items.

If the user chooses to display them, all is good. However if they choose not to show them they will find the page looks broken.

I was trying to work on a solution where, if the user chooses to hide them, I detect that and pop up a dialog explaining why the page looks broken and what they need to do to make it work.

I tried adding an image, loaded over HTTP with an onerror event to call the dialog but it doesn't fire when the image is blocked.

I understand that this is not an ideal situation in the first place and it's a problem that will eventually be solved but, in the mean time, any idea how I can detect which option the user has chosen?

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

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

发布评论

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

评论(1

傲娇萝莉攻 2024-10-26 09:30:31

我完全不确定这是否有效。如果您安装了 Apache,也许您可​​以通过本地 HTTPS 代理 HTTP URL。有点像挖隧道。

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

https://www.example.com [main page]
    https://www.example.com/help.html [pass unchanged]
    http://www.othersite.com [gets blocked]

应改为:

https://www.example.com [main page]
    https://www.example.com/help.html [pass unchanged]
    https://www.example.com/secure/?url=www.othersite.com [proxy it]

I am not at all sure if this will work. If you have Apache installed, may be you can proxy the HTTP URL through a local HTTPS one. Sort of like tunnelling it.

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

https://www.example.com [main page]
    https://www.example.com/help.html [pass unchanged]
    http://www.othersite.com [gets blocked]

This should be changed to:

https://www.example.com [main page]
    https://www.example.com/help.html [pass unchanged]
    https://www.example.com/secure/?url=www.othersite.com [proxy it]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文