Access parent URL from iframe

后端 未结 16 1684
野性不改
野性不改 2020-11-22 10:00

Okay, I have a page on and on this page I have an iframe. What I need to do is on the iframe page, find out what the URL of the main page is.

I have searched aroun

16条回答
  •  面向向阳花
    2020-11-22 10:23

    The following line will work: document.location.ancestorOrigins[0] this one returns the ancestor domain name.

提交回复
热议问题