且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

安全页面上iframe中的不安全内容

更新时间:2022-03-19 21:35:44

如果使用 https://www.example.com/main/index.jsp访问您的页面(SSL)如果HTML代码中有任何资源引用 http:// (非SSL)。这包括iframe。

If your page is being accessed using https://www.example.com/main/index.jsp (SSL) then your browser will complain with "This page contains both secure and insecure items" if there are any resources in the HTML code that are referenced with http:// (non-SSL). This includes iframes.

如果您的导航页面托管在同一台服务器上,那么您可以使用这样的相对URL阻止不安全内容消息...

If your navigation page is hosted on the same server then you can prevent the "insecure content" message by using a relative URL like this...

<iframe src="/app/navigation.jsp" />

从您的问题来看,您的导航页面似乎是从一个单独的主机提供的,而您正在***使用类似的东西

From your question it sounds like your navigation page is being served from a separate host and you're being forced to use something like this

<iframe src="http://otherserver.example.com/app/navigation.jsp" />

这当然会导致浏览器中出现不安全内容消息。

which will of course cause the "insecure content" message in your browser.

您唯一的解决方案是 b

Your only solutions are to either


  1. 在保存导航页面的服务器上实施SSL您可以使用 https:// 作为iframe参考,或

  1. implement SSL on the server holding your navigation page so you can use https:// for your iframe reference, or

将导航应用程序移至相同的服务器,因此您可以使用相对URL。

move the navigation application to the same server so you can use a relative URL.

我个人无法理解为什么你的导航会出现在另一台主机上,因为那样你就会得到JavaScript跨域脚本问题(除非涉及一些时髦的JSONP)。

Personally I can't see why your navigation would be on a different host because then you're going to get JavaScript cross-domain scripting issues (unless some funky JSONP is involved).