0

I'm displaying my site (www.example.com) inside of an iFrame of another site, let's say www.example.org. I have to load different content on my page when iFrame is loading on a certain subpage of this site, so it should load on:

www.example.org/subpageA

www.example.org/subpageB

But shouldn't load when the site URL on which it's loaded is equal to www.example.org/subpageC

I tried using document.location.ancestorOrigins[0] for this, but it's returning only "www.example.org" (without the path), no matter which subpage I am, so I can't define when this certain subpage is loaded. How can I collect the full path of the source page from which my site is loaded in an iFrame, including the /subpageC part?

humannus
  • 3
  • 5
  • Does this answer your question? [Access parent URL from iframe](https://stackoverflow.com/questions/3420004/access-parent-url-from-iframe) – Wyck Nov 10 '20 at 20:12
  • Sadly, no. All of the solutions suggested there are returning the `www.example.com`, instead of what I need - `www.example.org/subpageC`. – humannus Nov 10 '20 at 20:14

0 Answers0