Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have iframe break out of parent

Status
Not open for further replies.

ZendDeveloper

Programmer
Jan 3, 2009
15
GB
Hi,

I have a page that has an iframe that does some processing. When this has finished I need to have the parent close and for the page within the iframe to be the only one displayed.

The iframe does some credit card processing and redirects to a success page and it is this that I need to display outside of any iframes.

Is this possible, and if so how might I go about doing it.

I did think I could get the parent to redirect to the success page but this is not possible with the application I am using so I thought that if I could get the iframe to break out of the parent window without any refreshing of content this would solve it.

Thanks
 
do you have a way to detect that the IFrame has finished its job ? do you have control over the source code of the HTML page that the application in the IFrame uses for the page in question ?

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
do you have a way to detect that the IFrame has finished its job ? do you have control over the source code of the HTML page that the application in the IFrame uses for the page in question ?

see for some similar examples.

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
Hi Greg,

When the iframe has doen it's job it returns to a specified url. I always know where this is so no problem there.

The actual main processing that goes on in the iframe is off site (a payment gateway) so I have no control over what is there until it posts back a response.
 
on that page that is loaded (the specific url) redirect the parent url to the page you want...
Code:
<html>
<head>
<script language="javascript">
function goTo() {
parent.document.location = "[URL unfurl="true"]http://mylocation.com/mysubdir/mypage.html"[/URL]
}
</script>
</head>
<body onLoad="goTo();">

</body>
</html>




TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
vicvirk your idea is exactly where I was going with it, but as the IFrame'd page is not a page he controls I doubt that he would be able to add the code you suggest into it.

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
Thanks greg and vicvirk,

Yes unfortunately Greg has it right. I can't control what is sent back to me so this won't work unfortunately.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top