Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE10 (9,8) does not recognize DOCTYPE xhtml

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 attributes is from Moo, I don't know if it may be the same who edits the doctype, but I'm 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) 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, within the body (not sure that's OK but that's 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).

like image 354
Peminator Avatar asked Mar 05 '13 10:03

Peminator


1 Answers

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.

like image 69
userx Avatar answered Sep 21 '22 06:09

userx