简体   繁体   English

通过JavaScript跨嵌套iframe和不同域进行顶级域检测?

[英]Top level domain detection across nested iframes and different domains via javascript?

I know about iframes from different domains unable to access pretty much anything on the parent level, BUT, all I would need to know is the top-most domain. 我知道来自不同域的iframe无法访问父级上的任何内容,但我需要知道的是最高域。 Here is the scenario: 这是场景:

ABC.com loads an iframe from DEF.com that loads an iframe from XYZ.com. ABC.com从DEF.com加载iframe,而从XYZ.com加载iframe。 On the level of XYZ.com I need to know that ABC.com is the top most domain. 在XYZ.com级别上,我需要知道ABC.com是最顶级的域名。

Any thoughts? 有什么想法吗? Assuming top and intermediaries cooperation or without cooperation, are there any hacks for different browsers or? 假设高层和中介机构合作或不合作,是否有针对不同浏览器的黑客?

I have been able to come up with several different ways to do this kind of thing on Firefox, but I'd be interested to see this exploited for IE in some way. 我已经能够提出几种不同的方法来在Firefox上执行这种操作,但是我很想看到以某种方式将其用于IE。

I can't remember if the same-origin-policy prevents reading of the location or not (obviously, writing or modifiction is out ). 我不记得是否same-origin-policy阻止读取该位置(显然,写入或修改已完成 )。 But you can test it very easily. 但是您可以非常轻松地对其进行测试。

From a page on XYZ.com 从XYZ.com上的页面

alert( top.location.href );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM