Iframe payone redirect parent

拜拜、爱过 提交于 2019-12-04 21:01:16

I know this Q&A is older than dirt, but thought I'd clarify for anyone else looking for this information.

Since the redirect is going to be on a page in the same domain, cross domain scripting security doesn't come into play, so you don't need to put any code on the iframe parent, simply have the payment provider return to a page with the following:

<html><head><title></title></head>
<body onload="parent.location='http://www.google.com';">
If you are not redirect in 5 seconds, please click here...  etc..
</body></html>

Becaues of security and having now control over your payment provider, the easiest way to handle this is to have a 'landing' iframe page that the customer gets redirected back to from the payment provider.. That page then calls a function to reload the entire page to a new URL...

In the parent window: put this in the section

<script type="text/javascript">
    function payment_redirect(url) { document.location=url;}
</script>

Then just have a simple iframe landing page to trigger the update

<html><head><title></title></head>
<body onload="parent.payment_redirect('http://www.google.com');">
If you are not redirect in 5 seconds, please click here...  etc..
</body></html>

notice how i included the function in the parent window, and then called it from the iframe page via 'parent' - iframe security will not let you redirect or refresh a page directly from the iframe...

Since this question was raised, PAYONE have incorporated iframe-busting into their API. When creating the link or POST parameters to the payment form, include this parameter:

'targetwindow' => 'top'

Other permitted values are:

  • window
  • opener
  • top
  • parent
  • blank
  • self

The user returning from the payment form will be sent to the specified target window.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!