Forum Moderators: phranque

Message Too Old, No Replies

SSL issue for image calls in IE

A bug in the way IE calls images into an SSL page

         

Demaestro

11:49 pm on Jan 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I recently finished a website and launched a bunch of it under SSL. Some links that point to SSL will redirect you to SSL pages depending on your user account role and permissions. What was happening is when someone clicked a link that was http:// and was redirected to https:// they would have to click 'yes' to the IE warning message about leaving a secure page to a non-secure one. Which is fine, however it would pop this thing up for every image call before loading it into the page. Literally almost 100 times. It would even pop it up for the CSS file being loaded in. Now I can assure you all that these images come from a https:// source.

The issue has to do with how an image is loaded if the source path starts with a / . The browser is supposed to load the image with the domain (ie. [exampleURL.ca...] or [exampleURL.ca,...] depending whether or not the page you are viewing is under SSL) at the beginning.

Internet Explorer's brokenness occurs when you hit a page using http:// that then redirects to an SSL version of itself. Every other web browser realizes that it is now at an SSL page and uses https:// at the start of these image calls. Internet Explorer, on the other hand, gets confused and uses http:// to call those images. The server then redirects these to the https:// version in order to prevent a 'This page has both secure and insecure content' warning. Since the browser briefly went back to http:// before being redirected to [,...] it pops up this warning box for eveything being called into the page.

I just made changes to the link so they dynamically set the link to http:// or https:// depending on your role rather then doing it after the link was clicked. Of course this is only an issue on IE eveyone else played nice with the code as it was.

Thought I would share. I almost feel like I had it wrong but when only 1 brower breaks on it I wonder if it me or the browser.