IEInternals

A look at Internet Explorer from the inside out. @EricLaw left Microsoft in 2012, but was named an IE MVP in '13 & an IE userAgent (http://useragents.ie) in '14

Google Image Search and IE9 Beta

Google Image Search and IE9 Beta

Rate This
  • Comments 8

One of the commonly reported bugs on Connect is that Google Image Search shows grey boxes for some of the images in IE9 Beta. I had a quick look at the site this afternoon, and I can easily reproduce the problem, as you can see in the screenshot below.

NoImagesForNoSniff

Now, I tend to debug things first from the network level, so I fired up my trusty HTTP debugger and observed the traffic as I scrolled the page. I quickly noticed something interesting:

image

Google appears to populate the images using a JSONP callback, which is basically a JavaScript file. However, the Content-Type reported by the server is text/plain. Now, from past debugging sessions, I know that Google tends to send their content with the response header X-Content-Type-Options: nosniff. This header instructs IE not to attempt to “sniff” the content-type of a HTTP response.

As I mentioned earlier this month, IE9 will not execute script if the HTTP response headers specify X-Content-Type-Options: nosniff and do not specify one of the following Content-Types: ["text/javascript", "application/javascript", "text/ecmascript", "application/ecmascript", "text/x-javascript", "application/x-javascript", "text/jscript", "text/vbscript", "text/vbs"].

In this case, the server has sent IE JavaScript, but indicated that the content is not script and further promises that the plaintext Content-Type is authoritative. Hence IE9 does not run the script, and as a result, the image boxes (which are populated by the script) are left empty.

Fiddler users can “fix” this problem themselves by clicking Rules > Customize Rules and adding the following Javascript

static function OnBeforeResponse(oSession: Session)
         
  if (oSession.uriContains("jsonp") &&
     (oSession.oResponse["Content-Type"] == "text/plain"))
  {
     oSession.oResponse["Content-Type"] = "text/javascript";    
  }

I sent a mail over to the Google team and I’m confident that this will be fixed shortly.

Thanks for trying the IE9 beta and sending us your feedback!

-Eric

  • Great explanation! I do hope it will be fixed and will work.

    Thanks.

  • Mark Russinovich -> Mr. Process Explorer -> investigates obscure Kernel/Win32 related issues -> fascinating blog post

    Eric Lawrence -> Mr. Fiddler -> investigates obscure Internet related issues -> fascinating blog post

    Nuff said!

  • Thats an amazing post. Actually, I's wondering why the google images don't shows any images from page2 and so on, in ie9 beta. And thats a nice explanation, especially using the Fiddler.

    Thanks one again. :)

  • Curious - Is there any reason Google would be sending the responses that way in the first place?  Is there some tracking, anti-piracy, performance or other reason for this?

  • @Chad: The Google server is simply misconfigured. This misconfiguration would go unnoticed if Google wasn't sending the X-Content-Type-Options header. They've configured their server to return this header on all responses because it can improve security, however, as demonstrated here, it can also break your site if your MIME types are not set properly.

  • I dont get gray squares. Instead, in IE9 i have old scool Google image search, not the new version. Chrome and FF are ok. Help!

    EricLaw: It sounds like Google is now using a browser version check and returning different content to IE9. You could verify using the F12 developer tools which allow you to change the user-agent string. But ultimately, you'll have to ask Google when they plan to fix this.

  • They still haven't fixed it. "page 1" shows properly, then subsequent pages return the shadow box with the broken link icon in the corner.

  • @Reid

    IE9 came out of beta six months ago. Perhaps it's time to upgrade...

Page 1 of 1 (8 items)
Leave a Comment
  • Please add 5 and 4 and type the answer here:
  • Post