get parent.location.url - iframe - from child to parent

后端 未结 7 2440
时光说笑
时光说笑 2020-11-30 03:12

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 domai

7条回答
  •  醉梦人生
    2020-11-30 03:37

    What you're trying to do isn't possible per se. Unless you have control over the parent page's calling of the child page. If you do, then you can call the child page with a get statement in the URL of the parent page. So if you parent page is http://parentpage.com then here's how you should call the iFrame.