当使用 JQuery.load 加载页面时,IE7 和 8 会发出混合内容警告

发布于 2024-12-27 11:48:32 字数 583 浏览 0 评论 0原文

我有一个以两种不同方式加载的网页;用户可以单击其链接,它将在同一浏览器窗口中加载该页面;否则,可以在 JQuery 对话框中查看同一页面,并且仅该页面的内容区域显示在弹出窗口中。当此页面加载到主浏览器窗口中时,它在所有浏览器(所有版本)中都可以正常工作,但是当我在弹出窗口中加载它时,它仅在 IE7 和 IE8 中给出混合内容警告。

我花了一整天的时间寻找其根本原因,但没有成功。我已经尝试了下面给出的帖子中建议的所有修复:

  1. 所有链接要么是相对的,要么在网址中明确包含 https:。
  2. 对于浏览器下载的任何资源,我都没有任何 404 消息。
  3. 我查看了 Fiddler treffic,所有请求都是 https。
  4. 我不会删除任何在 style 属性中直接定义的具有 background-image:url 样式的 div。

正如你所看到的,我已经尝试了在线提供的所有建议/修复,但没有运气。我非常感谢这方面的帮助。

谢谢, 纳维德

I have a web page which loads in two different ways; user can click on its link and it will load that page in the same browser window; otherwise the same page can be viewed in JQuery Dialog with just the content area of that page is displayed in popup window. When this page gets loaded in the main browser window it works fine in all browsers (all versions) but when I load it in popup, it gives mixed content warning only in IE7 and IE8.

I have spent the whole day searching the root cause for it but without success. I have tried all the fixes that has been suggested in the posts which are given below:

  1. All the links are either relative or explicitely have https: in the url.
  2. I dont have any 404 message for any resource downloaded by the browser.
  3. I looked through the Fiddler treffic and all the requests are https.
  4. There is no src="javascript:" attribute in <script> tag.
  5. I am not removing any div with background-image:url style defined directly in the style attribute.

As you can see I have tried all the suggestion/fixes available online but with no luck. I would really appreciate help in this regard.

Thanks,
Naveed

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

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

发布评论

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

评论(3

不念旧人 2025-01-03 11:48:32

我花了很长时间研究我自己的版本。最终帮助我找到答案的是在 IE8 模式下使用 IE10 - 这给出了一个实际的特定错误。如果您遇到类似问题并且 Fiddler 或 HttpWatch 向您保证您实际上并未加载任何 HTTP,我强烈建议您这样做。

对我来说,问题出在一个将样式表链接附加到头部的脚本上:

$("head").append('<link href="//example.com/stylesheets/icons" media="screen" rel="stylesheet" type="text/css" />');

IE8 通常可以很好地处理协议相关的 URL,但在这种情况下显然不行。我必须提供一个明确的协议:

$("head").append('<link href="'+window.location.protocol+'//example.com/stylesheets/icons" media="screen" rel="stylesheet" type="text/css" />');

丑陋,但实用。希望这能让某人免于一些头痛!

I spend quite a while looking into my own version of this. What finally helped me find an answer was using IE10 in IE8 mode - this gave an actual specific error. I highly recommend that if you have a similar problem and Fiddler or HttpWatch assures you that you aren't actually loading any HTTP.

The problem for me turned out to be with a script that appended a stylesheet link to the head:

$("head").append('<link href="//example.com/stylesheets/icons" media="screen" rel="stylesheet" type="text/css" />');

IE8 generally handles protocol-relative URLs just fine, but apparently not in this case. I had to provide an explicit protocol:

$("head").append('<link href="'+window.location.protocol+'//example.com/stylesheets/icons" media="screen" rel="stylesheet" type="text/css" />');

Ugly, but functional. Hope this saves someone some headache!

2025-01-03 11:48:32

我终于能够解决这个问题,并将解决方案发布在这里,供任何在网络上搜索根本原因的可怜人使用。在我的例子中,这是由于在 3 个不同的标签(例如 )上使用了无效的“背景”属性造成的,由于某种原因,IE7 和 IE8 仅当这些页面加载到 jquery 对话框中时才会发出混合内容警告。如果直接在浏览器中加载同一页面,则不会出现警告。所以我仍然不明白为什么会发生这种情况。也许一些专家可以解释为什么它会出现这样的行为。
感谢大家的回复。

I have finally been able to resolve this issue and posting the resolution here for any poor soul who's searching around over the web for the root cause. In my case this was being cause by an invalid 'background' attribute being used on 3 different tags (e.g. ) for some reason IE7 and IE8 were issuing mixed content warning only when these pages were being loaded in a jquery dialog. If the same page was being loaded in the browser directly there was no warning. So I am still clueless about why that was happening. May be some experts can shed light on why it was behaving like that.
Thanks everyone for your responses.

锦爱 2025-01-03 11:48:32

常见的罪魁祸首包括 CSS、iframe URL 和脚本 URL 引用的图像。

你说在Fiddler中没有看到HTTP请求;但也许那是因为它当前正在阻止非安全资源。告诉你的浏览器获取所有非安全资源,然后观看 Fiddler。

Common culprits include images referenced by your CSS, iframe URLs, and script URLs.

You say that you see no HTTP requests in Fiddler; but maybe that's because it's currently blocking the non-secure resources. Tell your browser to fetch all non-secure resources and watch Fiddler after that.

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