K Groll
K Groll

Reputation: 518

Getting the url of a page thats had a frame busted out of it

I'm using (not by choice) a 3rd party html form service, which are displayed on the website I'm working on in an iframe.

Using the form backend it's possible to specify a page to redirect to, this page appears within the forms iframe.

I'm using this frame buster:

<script type="text/JavaScript">if (parent.frames.length > 0) 
top.location.replace(document.referrer);</script>

This is fine, my problem is I need a parameter from the URL of the page the iframe is on. Using the above frame buster the document.referrer is the page within the frame that's being busted, not the url (with the parameter) of the containing page.

How can I get the URL of the page that contains the iframe, once the above script is used to bust that frame?

Upvotes: 0

Views: 168

Answers (1)

pravin
pravin

Reputation: 231

Ok you can do this by the following method:

 "window.top.location" in iframe

Upvotes: 1

Related Questions