IE10 (9,8) does not recognize DOCTYPE xhtml

Peminator picture Peminator · Mar 5, 2013 · Viewed 27.9k times · Source

IE10 rejects to launch some jQuery code, as far I found on runtime somewhere a doctype is wrong detected and prepended with 4.01 transitional version

in IE's developer tools viewing the console i see HTML1524: Invalid DOCTYPE. The shortest valid doctype is "<!DOCTYPE html>". and following (runtime modified) html:

I believe both misuse of DOCTYPE and some jQuery not working have a common reason, but did not find what it is

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><HTML 
xmlns="http://www.w3.org/1999/xhtml" slick-uniqueid="1"><HEAD><META 
content="IE=10.000" http-equiv="X-UA-Compatible">

<META http-equiv="X-UA-Compatible" content="IE=edge">
<META http-equiv="Content-Type" content="text/html; charset=windows-1250">
<TITLE>....

while IE states to run in standards mode, still some things do not work (mainly replacing the links with jQuery's on click events to show content instead loading whole new page - used for unpacking other menu branch using accordion, original links in category headers with href are fallback only for case jQuery fails to animate accordion)

too many other on click events or jquery ui functions to make link to look like button fail to function in IE while working in other browsers

original html as provided from server is following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="sk" lang="sk">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<title>...

i am forced to use both mootools and jQuery and know the slick-uniqueid in htm atributes is from moo, don know if it may be the same who edits the doctype, but Im sure it happens in IE browsers only, Chrome and Firefox just work ok

jQuery scripts are loaded from external js file, wrapped in jQuery(function() {.. and all use full variable name jQuery instead of dollarsign, for example jQuery("#myid").click( function(e){...

as using both mootools and jQuery (I know i should not but need some mootools plugin for slideshow with thumbnails and KenBurns effect /anyone knows free jQ alternative??/) and jQuery is loaded first and within scripts i use only jQuery()... so the $ dollarsign is all free for mootools to use later on as it is loaded just if needed, withing the body (not sure thats ok but thats the way how 'visualslideshow' presented it)

I'd be glad to hear any ideas or suggestions on how to identify or fix it to get the jQuery working right (v1.8)

Answer

userx picture userx · Apr 21, 2013

Change your DOCTYPE to:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

(using XHTML strict instead of transitional)

IE10 will stop throwing the error in the console. I'm not sure why IE10 doesn't like transitional XHTML any more. If anyone has a way for IE10 to recognize the XHTML 1.0 Transitional DOCTYPE, that would be awesome.