Classic ASP page automatically sets Quriks mode as default in IE 8 - asp-classic

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">
it doesn't really help.
What should I do?

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">
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?

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.

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.

Related

IE11 always render page in Document mode EDGE on locally hosted website

In IE11, my local hosted sites always renders with Document Mode= EDGE. Technically it should use doctype IE9, because of my page doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Below are steps i have preformed before posting
unchecked "Display internet sites in Compatibility View" from
IE, also my compatibility view list is empty.
Check my machine.config,web.config(global),web.config(website).
there is no Compatibility relevant configuration in them.
Also there is no metadata in my page the force browser to render it in
EDGE mode.
My dev environment is Windows7 64bit, ASP.net 4.5 and IIS 7.5
Thanks for reading the question.
Your DOCTYPE declaration will trigger the highest mode available to the version of IE used to view the page.
To force the page to IE9 standards mode, add the following as the first line of your page's section:
<meta http-equiv="x-ua-compatible" content="IE=9">
Please note that this may not be an ideal experience in the long run. When you view the page using MS Edge, it will be rendered in Edge mode (since Edge does not support x-ua-compatible). Also, the IE9 specific features you're hoping to rely on may have been removed in a more recent version of IE.
Hope this helps...
-- Lance

some page in my website didn't load doctype, so it display in quirks mode, can anyone help me?

here is my website: http://kidscare.edu.vn
When open it in IE9, the homepage switch to quirks mode and it display ugly
but when open another page, it will display fine http://kidscare.edu.vn/babiescare
I use F12 tool to inspect, and I saw the doctype was not load in the header
Can anyone help me to solve it?
Don't use F12 tool (Firebug or IE's equivalent) to see if the doctype is loaded. These tools DO NOT show you the source, they show you how they inerpret the source.
To actually view the source, right click the screen and choose "View source".
The reason this displays in quirksmode I believe is because you are using the transitional doctype.
So try using the strict doctype instead:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Correct content type for html use?

I was using XHTML on my website but that completely destroyed jQuery and its plugins.
Therefore, I want to go back to html 4. I am defining some custom attributes for my html, like so:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd" [
<!ATTLIST mytag myattribute CDATA #IMPLIED>
]>
This seems to be valid html for, but when I pass such a page from my server with a content type of text/html, my browser displays ']>' - it can't parse the doctype properly.
Is there a different content type I should be using?
From A List Apart
If you run such a file through the W3C validator, you find that it
validates wonderfully well. If you download the sample files for this
article and validate file internal.html, you can see this for
yourself. Unfortunately, when you display the file in a browser, the
]> shows up on the screen. There’s no way around this bug, so this
approach is right out.
So this basically isnt going to work. To get it to work you need to copy the DTD you want the server/local machine, edit it appropriately and put it in a publically accessible place. See the article for more detail.
As far as jQuery is concerned, it should work fine if you quit trying to customize the DTD in the fashion that you are. Im not sure about using a custom DTD as I have never done it, but just adding the attributes to the elements and not defining them in the DTD shouldnt cause a problem with jq. Granted the document wont validate, but validation is just a tool and not overly important in the grand scheme of things.

IE9 ignoring CSS for certain pages?

I have different sites being served up, essentially running off the same code. One page renders correctly, while the other appears to have no CSS available.
When I bring up the IE9 developer console for the broken page, I see:
SEC7113: CSS was ignored due to mime type mismatch
So that explains why the pages render improperly, but the question is, why am I seeing that error on one page, but not the other?
Using fiddler, the same CSS is served to both sites, and both sites have a the metatag:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
I know IE9 is still in beta, but I am trying to figure out why this is a problem with my site.
This doesn't look like an IE emulation thing - it sounds like the CONTENT-TYPE in the response isn't "text/css". It looks like IE9 enforces that files that are expected to contain CSS are actually marked as such.
Just out of interest, are the CSS pages processed in any way? i.e. are they rendered by an ASPX page to allow you to inject CSS? If that's the case then you may want to make sure your page declaration at the top includes the ContentType declaration, e.g.:
<%# Page Language="C#" ContentType="text/css" %>
It turns out, IE9 will ignore the missing content-types for all sites that in your "trusted-zone."
Sites outside of the trusted zone will not render the css if there is a missing content-type header.

HTML 5 versus XHTML 1.0 Transitional?

It seems that HTML 5 is going to be supported (partially) by Firefox 3.1 and other browsers. It is adding support for video and audio as tags, but these are new tags that XHTML 1.0 Transitional does not recognize. What is the behavior supposed to be if I use a new HTML 5 tag in a future version of Firefox but use the DTD for XHTML? And what if I mix HTML 5 markup with XHTML 1.0 Trans?
This is getting confusing. Why didn't they just add these tags to XHTML? How do we support both XHTML and HTML 5?
Video on HTML 5: http://www.youtube.com/watch?v=xIxDJof7xxQ
HTML5 is so much easier to write than XHTML 1.0.
You don't have to manually declare the "http://www.w3.org/1999/xhtml" namespace.
You don't have to add type attributes to script and style elements (they default to text/javascript and text/css).
You don't have to use a long doctype where the browser just ignores most of it. You must use <!DOCTYPE html>, which is easy to remember.
You don't have a choice to include or not include a dtd uri in the doctype and you don't have a choice between transitional and strict. You just have a strict doctype that invokes full standards mode. That way, you don't have to worry about accidentally being in Almost standards mode or Quirks mode.
The charset declaration is much simpler. It's just <meta charset="utf-8">.
If you find it confusing to write void elements as <name>, you can use <name/>, if you want.
HTML5 has a really good validator at http://validator.nu/. The validator isn't bound by a crappy DTD that can't express all the rules.
You don't have to add //<![CDATA etc. in inline scripts or stylesheets (in certain situations) to validate.
You can use embed if needed.
Just syntax-wise, when you use HTML5, you end up with cleaner, easier to read markup that always invokes standards mode. When you use XHTML 1.0 (served as text/html), you're specifying a bunch of crud (in order to validate against a crappy dtd) that the browser will do automatically.
Myths and misconceptions abound in this thread.
XHTML 1.0 is older than HTML 5. It cannot use any new vocabulary. Indeed, its main selling point was that it uses exactly the same vocabulary as HTML 4.01.
There will be no XHTML 1.2 - most probably. And it is not needed. XHTML 5 is the XML serialization of HTML 5. Identical vocabulary, different parsing rules.
HTML has never been treated as true SGML in browsers. No browser has ever implemented an SGML-compliant parser. HTML 5 will make this fact into a rule and the HTML serialization will follow todays de facto standard. One could perhaps say that it is "SGML-ish".
As it has been stated, the DTD serves exactly one purpose IN BROWSERS, and that is to distinguish between standards compliance mode and quirks mode. Thus it affects only styling and scripting. If you are using frames on a page with astrict doctype, they will render just fine. As will <embed> and even <marquee> - even though the latter is an abomination and the former not in any current standard. It is part of HTML 5, though.
Video and audio can be used regardless of serialization, XML or HTML. they are part of both HTML 5 and XHTML 5. Once the parsing stage is over a browser will have constructed an internal DOM of the document. That DOM will be for all practical purposes the same regardless of serialization. And yes, XHTML sent with text/html is still normal html, regardless of doctype.
Well, generally speaking HTML is SGML and XHTML is expressed in XML. Because of that, creating XHTML is connected with more restrictions (in the form of markup) than HTML is. (SGML-based versus XML-based HTML)
As mentioned on Wikipedia, HTML 5 will also have a XHTML variant (XHTML 5).
Rule of thumb: You should always use valid markup. That also means that you should not use the mentioned <video> or <audio> tags in XHTML 1.0 Transitional, as those are not an element of that specification. If you really need to use those tags (which I highly doubt), then you should make sure that you use the HTML 5/XHTML 5 DTD in order to specify that your document is in that DOCTYPE.
Using HTML 5 or XHTML 5 in the given state of the implementation (AFAIK, the standard is not even settled, yet, correct?) could be counter-productive, as almost all users may not see the website rendered correclty anyways.
Edit 2013:
Because of the recent downvotes and since this accepted answer cannot be deleted (by me), I would like to add that the support and standardization process of HTML5 is nowadays totally different to what it was when I wrote this answer five years ago. Since most major browsers support most parts of the HTML5 draft and because a lot of stuff can be fixed with polyfills in older browsers, I mainly use HTML5 now.
You might be looking at the problem the wrong way because the relationship to XHTML 1.x section, HTML 5 states:
"This specification is intended to replace XHTML 1.0 as the normative definition of the XML serialization of the HTML vocabulary."
Now that language is controversial (the XHTML 2 WG has disputed it and the HTML WG is trying to resolve the differences...) but that's where we stand right now.
A couple of notes:
HTML 5 includes an XML serialization known as XHTML 5, the spec explains the differences if you're into nitty gritty details
HTML is not SGML. Henri Sivonen has done a great write up on the history of HTML parsing
As of this time (it has been a topic of debate several times), there won't be a DTD for HTML/XHTML 5 -- the Conformance Requirements section of the spec explains why a DTD isn't suitable for defining the HTML language. The HTML 5 validator also contains a wealth of information on this topic (including RELAX NG schemas for HTML5)
Keep in mind that doctypes only serve one purpose in browsers: switch between quirks, almost standards and standards mode. Therefore, using <video> and <audio> will work with any doctype declaration. IMO, using an XHTML doctype is quite useless, as every page you send with text/html MIME type is parsed as (tag-soup) HTML anyways. I suggest using the HTML5 doctype (<!doctype html>), as it is easier to remember and doesn't force you in XML syntax without a reason.
Why didn't they just add these tags to
XHTML?
They actually did, there is an XML serialization of HTML 5 (XHTML5). To use this, you have to send your pages with an XML MIME type, such as application/xhtml+xml. This is not (yet) supported by IE, though.
What is the behavior supposed to be if
I use a new HTML 5 tag in a future
version of Firefox but use the DTD for
XHTML?
And what if I mix HTML 5 markup with
XHTML 1.0 Trans?
If your markup isn't implemented as part of your chosen DTD - then logically, that markup shouldn't be followed. But browser implementations aren't always strictly logical.
Why didn't they just add these tags to
XHTML? How do we support both XHTML
and HTML 5?
xHTML is not better than HTML, but it's more suited to some applications. One of the main benefits of xHTML is that it can be transformed into different formats using XSLT. For example, you could use XSLT to automatically transform xHTML into an RSS feed or another XML format.
You don't need to support both formats - weigh up the benefits/drawbacks for each with your project's requirements. HTML 5 probably won't be standard for quite some time.
(X)HTML5 is just the next version. You should be using XHTML1.1 until XHTML5 is well-supported.
You probably should not use the backwards-compatability SGML profile of HTML5. It makes things harder for scrapers and small parsers.
Your doctype will tell the browser whether you're using HTML5 or XHTML. You can't just shove a tag from one doctype into a document of another doctype and expect it to work.
Without a doctype, it's all just tag soup anyway.
Don't use things like video/audio tags when 99% of people won't be able to view it properly on their browser. For either of these two examples I'd suggest using FLV.
As far as why they don't add it to XHTML... firstly 1.0 isn't the most recent version, 1.1 was released a while ago.
Eventually things get standardized and we'll see these types of tags in both standards, but for now just do what you can to ensure the most amount of people can view your content.

Resources