Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I dug up this old code of ours, hopefully it can help you. In order for it to work, tell PayPal to go to failure.html/success.html as appropriate.
- In the parent frame that launched the PayPal popup/modal thing:
- <script>
- // Close the PayPal iFrame
- // This function has to exist in the parent frame
- // because only the parent frame has the authority
- // to remove PayPay's iframe
- function closePayPal(){
- $('#PPDGFrame').remove();
- }
- </script>
- ---------------------------------------------------------------------------------------
- failure.html
- <!DOCTYPE html>
- <html>
- <head>
- <title>Failure</title>
- </head>
- <body onLoad='setTimeout(handleEmbeddedFlow,200);'>
- Loading gif
- </body>
- <script>
- function handleEmbeddedFlow() {
- // Tell the parent to close this iFrame
- parent.closePayPal();
- }
- </script>
- </html>
- ---------------------------------------------------------------------------------------
- success.html
- <!DOCTYPE html>
- <html>
- <head>
- <title>Success</title>
- </head>
- <body onLoad='setTimeout(handleEmbeddedFlow,200);'>
- Loading gif
- </body>
- <script src="inject.js"></script>
- <script>
- function handleEmbeddedFlow() {
- // Inject the thank-you page
- // In inject.js there's a function that loads content via AJAX,
- // that's just how our site works. You could replace
- // inject() below with location.replace() or something like it.
- window.top.inject(BASE_URL + 'thank-you/');
- }
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement