get parent.location.url - iframe - from child to parent
问题 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? 回答1: try this: var referrer = document.referrer; alert(referrer); 回答2: What you're trying to do isn't possible per se. Unless you have control over the parent