开发者

IE=EmulateIE8 does not recognize application/javascript

开发者 https://www.devze.com 2023-02-27 10:17 出处:网络
I wonder why internet explorer does not recognize meta head for javascript set to application/javascript?

I wonder why internet explorer does not recognize meta head for javascript set to application/javascript?

<meta http-equiv="x-ua-compatible" content="IE=EmulateIE8"/>
<script type="application/javascript" src="..."/>

doesn't work, but when i change it to

<meta http-equiv="x-ua-compatible" content="IE8"/>
<scri开发者_运维技巧pt type="application/javascript" src="..."/>

it works..

i'd like to use default javascript type that is "application/javascript"


[Since you're specifying IE8-compatibility, I presume you're using IE9?]

The problem is your script tag.

<script> cannot be self-closing, so you can't say this as you have:

<script src='...' />

You have to do

<script src='...'></script>

I can't say why your meta tag is affecting it like that, though. Possibly the IE8 rendering engine is more fussy about this point than the IE9 engine.

I would also say that the first version of your meta tag is correct, while the second one isn't, so the second one won't be triggering the browser mode.


IE9 in compatibility mode and IE8 don't accept application/javascript. They do fine with text/javascript though so you can just use that. Or you can just leave out the type attribute altogether.

This issue sometimes leads to bugs that manifest in surprising ways.

0

精彩评论

暂无评论...
验证码 换一张
取 消