开发者

document.domain with a 2-letter domain name bugs in IE

We have a domain name with two letters in it. This is a problem with IE, for all versions.

The problem is that when we set document.domain=开发者_如何学运维"xx.yy" we get an "invalid argument" exception.

Does anyone have a solution or an idea on how to work around this bug?

Regards, Tobias


There are limitations on what domains can be used as a shared parent domain for cross-document scripting and cookie sharing.

This is deliberate: otherwise, example.co.uk and other-example.co.uk could act as part of the same site co.uk. Browsers don't want to allow this, for privacy and security reasons.

The problem is that the DNS system doesn't have an official way to state that co.uk is a registry-allocated domain under which separate organisations live, but bit.ly is a single organisation. This is even harder in some places, like .jp which has both direct organisation subdomains and registry-allocated subdomains like co.jp.

So browsers have internal rules of what domains should be taken as ‘public’ and shouldn't be allowed to share scripting/credentials context, and these rules have to be updated when there are new TLDs and SLDs. Older browsers may not recognise newer domains.

Some browsers take their information from the Public Suffix List, though not IE. IE would appear to be using the heuristic that, for a TLD it doesn't know about and have a special-case for, a 2-letter subdomain xx.yy is likely to be a public domain (like co.uk, or.jp or whatever) and shouldn't be allowed to act as a shared parent domain. This is a reasonable guess, IMO: better to ‘fail safe’.

I don't think you're going to be able to circumvent it. What are you trying to do, might there be another way around? Can you put all the cross-subdomain scripting stuff in a sub-subdomain?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜