获取parent.location.url - iframe - 从孩子到父母 [英] get parent.location.url - iframe - from child to parent
本文介绍了获取parent.location.url - iframe - 从孩子到父母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从该页面(子页面)获取js的parent.location.url。
我的页面显示在iframe中。 / p>
这两个网站都在不同的域中。
我在尝试:
alert(parent.location.url)
但是我得到这个错误:
http:// parentdomain 从 http:// childdomain 。
?????是否可能?
解决方案
试试这个:
var referrer = document.referrer;
alert(引荐);
I got a page that is displayed within an iframe.
I need to get the parent.location.url with js from that page (child page).
Both sites are in different domains.
I'm trying:
alert(parent.location.url)
But I get this error:
Permission denied for http://parentdomain to get property Location.URL from http://childdomain.
???? Is it possible?
解决方案
try this:
var referrer = document.referrer;
alert(referrer);
这篇关于获取parent.location.url - iframe - 从孩子到父母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文