Output from iframe using meta update or javascript?

I basically have a page that displays a “processing” screen that has been cleared of the browser. Later I need to redirect this page, we are currently using meta refresh, and this works just fine.

With the new payment system, which includes 3D security, we may find ourselves in the framework of an iframe sent back to our website from a third party.

I need to be able to redirect from this page using javascript or a meta update, and throw it out of the iframe if it exists.

Hooray!

(I used to exit iframes, but could not find my old code, and google search was useless, thought it was the perfect time to try Stackoverflow!)

+3
source share
3 answers

So, I added the following to my redirected pages. Fortunately, they have nothing in them, so you can simply redirect them. Also, using javascript is fine, as you need to get to this point on the site.

<script type="text/javascript" language="javascript">
    if (top.frames.length>0)
    setTimeout("top.location = window.location;",100);
</script>
+4
source

I am doing something similar to keep the old set of frames in it:

<SCRIPT TYPE="text/JavaScript">
    if (window == top){top.location.replace("/foo.html");}
</SCRIPT>

So, to exit the iframe, just change == to! =

I see that you are using setTimeout in your example. Waiting for an exit from the iframe requirement, or are you more likely to happen immediately?

0
source

if you use javascript:

parent.document.location = "http://www.google.com"

and if you use html:

<a href="http://www.google.com" target=_top >Google</a>
0
source

Source: https://habr.com/ru/post/1699264/


All Articles