Naveed
Naveed

Reputation: 123

IE7 and 8 gives mixed content warning when page is load with JQuery.load

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

Upvotes: 3

Views: 1880

Answers (3)

David
David

Reputation: 471

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!

Upvotes: 3

Naveed
Naveed

Reputation: 123

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.

Upvotes: 1

Jacob
Jacob

Reputation: 78920

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.

Upvotes: 0

Related Questions