开发者

Lowering document.domain

开发者 https://www.devze.com 2022-12-28 22:09 出处:网络
What am I doing wrong? According to specs lowering domain with JavaScript should be possible in IE8 and IE7 but my code only works in Firefox and throws an Argument Exception in IE.

What am I doing wrong? According to specs lowering domain with JavaScript should be possible in IE8 and IE7 but my code only works in Firefox and throws an Argument Exception in IE.

<html xmlns="http://www.w3.org/1999/xhtml" >
<body onload="alert(document.domain); try { document.domain = 'if.se' } catch(e) { alert(e); }; alert(document.domain);">
</body>
</html>

Edit

The 开发者_如何学Pythonproblem might be because of two letter domain. I tested with three letter domain (iff.se) and it worked, but a two letter domain failed (if.se)


It's probably getting caught inside a sanity check to make sure you don't try and set document.domain to co.uk or something silly like that.

0

精彩评论

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