Forum Moderators: phranque

Message Too Old, No Replies

IE8 Beta 2 and IE7 Compatibility mode

Hoping for a cure in .htaccess

         

icedowl

5:36 am on Sep 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just tried IE8 Beta 2 and found that loading my content was greatly delayed or was never displayed while using it. I've uninstalled IE8 Beta 2 at this point and am both disappointed and worried.

According to Microsoft:

To enable Compatibility View for your whole Web site or for certain Web site directories, include the following custom HTTP header for all requests to your site or directory.
X-UA-Compatible: IE=EmulateIE7

My question is this: Can that bit of code be placed in the .htaccess file or does one have to edit hundreds of pages to implement it? Or is there another solution?

What has me worried is the content that was not loaded properly was straight HTML with no frills. Nothing fancy, just plain old fashioned HTML. Basically, the heart and soul of my site. :(

jdMorgan

2:23 pm on Sep 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A bit of mod_headers in a <FilesMatch> container ought to do it:

<FilesMatch "\.(s?html?¦php[45])$">
Header set X-UA-Compatible: "IE=EmulateIE7"
</FilesMatch>

You may wish to tweak the regular expression pattern in this <FilesMatch> directive. I set it so that the header will be sent when serving files of the following types: .shtml, .shtm, .html, .htm, .php, .php4, .php5. Adjust to suit your site. Note that this directive is based on the names of the files that URLs resolve to, and not on the URLs themselves.

Make the pattern as specific as possible; There's no use sending the header with "non-page"-type content such as images/media or external JavaScript or CSS. On the other hand, it shouldn't hurt, other than to waste bandwidth.

Replace the broken pipe "¦" character with a solid pipe before use; Posting on this forum modifies the pipe characters.

Jim

icedowl

3:51 pm on Sep 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you Jim. My fingers are crossed that this works because I'm personally not ready to try IE8 Beta 2 again just to see. I do know that it is doing no harm as is in IE7. I did copy it just as you wrote it with the only change made being that of the pipe character.

jdMorgan

4:04 pm on Sep 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please use the "Live HTTP Headers" add-on for Firefox, and check that the new header is being sent properly. I'd rather you don't use that code on your server if it's completely untested -- Crossing your fingers is not a very safe or good methodology when it's your Web site at risk...

Jim

icedowl

4:38 pm on Sep 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks again for that suggestion. The "Response Headers" includes a line that states:

X-UA-Compatible IE=EmulateIE7

jdMorgan

5:22 pm on Sep 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There should be a colon after "Compatible", but at least the basic header-sending seems to work.

Jim

icedowl

8:55 pm on Sep 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is a colon in my .htaccess file. The Firefox Live HTTP Headers just didn't show it in its display box.

jdMorgan

11:42 pm on Sep 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not good -- That indicates that it's being "dropped" by mod headers. I don't know if that's a server config problem or not, because I've never seen a header missing a colon before... You might want to ask your host about this, unless someone here can add more info.

Jim

icedowl

3:23 am on Sep 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe it's more of a problem on my part. I do not normally use Firefox and I brought it up and added the Live HTTP Headers at your suggestion. Using it here at WW shows no colons for anything either. Hmmm.

jdMorgan

3:53 am on Sep 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, I guess the bottom line is whether IE recognizes it or not. If none of the other headers are showing colons after the header name, and you can still access this site, then it must be a Live HTTP Headers display problem, not an actual headers problem.

[added] After experimenting a bit, I see that if you access Live HTTP Headers through Firefox's Tools->Page Info screen, it does not show the colons, whereas if you open Live HTTP Headers in it's own sub-window by clicking on its icon in the navigation toolbar, it does. So I got confused when you said that there was no colon on the X-UA-Compatible header, but did not mention that there was no colon on any other header, either. This server stuff is all details, details, details... ;) [/added]

Jim

icedowl

5:31 am on Sep 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, the Page Info screen is what I used. I couldn't figure out how to use it otherwise.

jdMorgan

1:56 pm on Sep 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Click Tools->Live HTTP Headers or add the Live HTTP Headers icon to your navigation bar by right-clicking in the navigation bar and using the usual Firefox "Customize toolbars" facility, then click on that icon.

This will open LHTTPH in a separate sub-window that records all HTTP transactions involved in loading pages and their included images/CSS/scripts, etc., can be scrolled back and forth, and can be saved to a log file -- among other things. Very handy for debugging cookie, cache-control, redirect, and error response header issues.

Jim

icedowl

3:37 pm on Sep 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks again! That works and the colons do show in that mode.