Reputation: 834
Greeting!
I have a webpage with a Iframe in it. The Iframe is from a third party app that the user can use. once the user finishes the application and tells the Iframe application that they are complete, they press the submit button. Once the submit button is pressed, it redirects them to a page on my site, but they still inside the Iframe.
My question is - Is there a way to force the page they are redirected to redirect the PARENT page of the Iframe? I have encountered several session/cookie issues that force the user to relog into the Iframe, thus causing a endless wave of Iframes. If I could simply simple tell Iframelanding.php to redirect its parent page to myaccount.php I would not have the compatibility issues.
Does anyone have any experience with this?
Upvotes: 1
Views: 6634
Reputation: 776
<script>
$(function(){
var isInIframe = (window.location != window.parent.location) ? true : false;
if(isInIframe == true){ //redirect if iframe
window.top.location.href = "http://gmail.com/";
}
});
</script>
Upvotes: 0
Reputation: 1069
consider using this in your :
<head>
<base target="_parent" />
</head>
Upvotes: 3
Reputation: 813
Maybe you could try this on your iframe landing page, it will redirect the parent iframe but they have to be in the same domain.
window.top.location.href = "http://www.example.com";
Upvotes: 6