views:

240

answers:

3

While viewing the HTML IE 8 sets the default document mode as IE8 Standards as it should but it enters quirks mode on an asp page.
Even if I use <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; it doesn't really help.
What should I do?

+2  A: 

First thing I would do would be place identical output in a HTM file and visit that instead. If you get different results then there really is something wierd going on because I doubt IE8 has any way to treat "asp" any differently.

BTW, How do you know its actually going into quirksmode?

What happens if you use stronger DTD like this:-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;

Does it still remain in quirksmode?

You're not confusing IE7 compatibility with Quirksmode are you?

IE7 had a number of bugs in how it render even Standards mode HTML, perhaps what are seeing is IE7 compatibility instead.

Use fiddler to examine the headers being sent with the content. Is there a header like this:-

X-UA-Compatible: IE=EmulateIE7

in the response?

Is the Compatibility button present next to address in the brower UI?

AnthonyWJones
I'm not confusing with IE7 compatibillity mode for sure. I believe that because ASP is an old technology maybe it's fair to assume it's written poorly but that messes up with what I'm programming with at the moment (and yeh ASP sucks but what can I do? It's legacy code)I'll give you more answers when I'll be in the office.
the_drow
@the_drow: I have to say I completely disagree, it definitely is __not__ fair to assume that because its old technology its written poorly. Perhaps you are refering to the legacy code you are having to modify? Again its not fair to say that poorly written ASP code is "because" its old technology, it may be poorly written because the original developer wrote it poorly.
AnthonyWJones
@the_drow: Coming now to your question, you should check with view source that the DTD is present. If the DTD is present then its highly unlikely that IE is in quirksmode. Inject this JScript `alert(document.compatMode)` in to your page if you see "CSS1Compat" its in standards mode. If not then the fault isn't with ASP (its done what it should) the fault is in IE somehow although I can't image what that might be.
AnthonyWJones
I see BackCompat instead of what I should get.The DTD is now `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="he" lang="he">` and yet it is still reversing to quirks mode. My reasoning behind the thought that it's the asp extention's fualt is because IE assumes it's old and should be handled this way. This sucks.
the_drow
@the_drow: Try a simple "Hello world" ASP page include that little alert in onload and vary the DTD, what do you get? What happens if you put exactly same content in a HTML file? If you get different results use fiddler to compare headers between the two requests.
AnthonyWJones
Same. This is frasturating.
the_drow
A: 

The only thing that actually works is <meta http-equiv="X-UA-Compatible" content="IE=8"/>, other browsers will ignore it but IE will be forced to be in IE-8 mode unless you've done something really stupid like putting something before the HTML.

the_drow
A: 

I write standards based classic ASP all the time. The things to check would be your HTTP headers. Make sure something isn't being inserted into your HTTP header to cause it to use quirks mode. Might check your IIS box to make sure there isn't something being sent in the "Custom HTTP Headers" section in IIS. Also, check that your doctype is indeed correct. Lastly, make sure that you do not have any of IE's special meta tags that can change the rendering mode. Just because classic ASP is old doesn't mean that the browser would display it any different than any other HTML page. Honestly the browser doesn't really even care what the extension is. If it is served as html mime type then it will render as such.

Fred Clown
And if my solution below solves it why not use it?
the_drow