-1

I have an question:

Some page have iframe in which they display my service.

My service is written in Java.

Is there any possibility, to get url address (referrer) of page with iframe in which my page is displayed ?

Thanks

Ilkar
  • 2,113
  • 9
  • 45
  • 71

1 Answers1

0

If you're trying from your iFrame to get the url of the main page, it's only possible if they are in the same sub domain.

Access parent URL from iframe

Yes, accessing parent page's URL is not allowed if the iframe and the main page are not in the same (sub)domain. However, if you just need URL of the main page (i.e. the browser URL), you can try this

var url = (window.location != window.parent.location) ? document.referrer: document.location;
Community
  • 1
  • 1
Xavier Delamotte
  • 3,519
  • 19
  • 30