Advertisement
Guest User

Untitled

a guest
Jul 18th, 2013
845
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.47 KB | None | 0 0
  1. 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.
  2.  
  3. In the parent frame that launched the PayPal popup/modal thing:
  4.  
  5. <script>
  6. // Close the PayPal iFrame
  7. // This function has to exist in the parent frame
  8. // because only the parent frame has the authority
  9. // to remove PayPay's iframe
  10. function closePayPal(){
  11.      $('#PPDGFrame').remove();
  12. }
  13. </script>
  14.  
  15.  
  16. ---------------------------------------------------------------------------------------
  17.  
  18.  
  19. failure.html
  20.  
  21. <!DOCTYPE html>
  22. <html>
  23. <head>
  24.     <title>Failure</title>
  25. </head>
  26. <body onLoad='setTimeout(handleEmbeddedFlow,200);'>
  27. Loading gif
  28. </body>
  29. <script>
  30. function handleEmbeddedFlow() {
  31.     // Tell the parent to close this iFrame
  32.     parent.closePayPal();
  33. }
  34. </script>
  35. </html>
  36.  
  37.  
  38. ---------------------------------------------------------------------------------------
  39.  
  40.  
  41. success.html
  42.  
  43. <!DOCTYPE html>
  44. <html>
  45. <head>
  46.     <title>Success</title>
  47. </head>
  48. <body onLoad='setTimeout(handleEmbeddedFlow,200);'>
  49. Loading gif
  50. </body>
  51. <script src="inject.js"></script>
  52. <script>
  53. function handleEmbeddedFlow() {
  54.     // Inject the thank-you page
  55.     // In inject.js there's a function that loads content via AJAX,
  56.     // that's just how our site works.  You could replace
  57.     // inject() below with location.replace() or something like it.
  58.     window.top.inject(BASE_URL + 'thank-you/');
  59.  
  60. }
  61. </script>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement