Communication between pop up window and original opener

I am trying to build an integrated payment solution onto an existing site.

I have a popup window that opens a third party payment processor page when I submit my shopping cart contents form.

I want to be able to communicate with the original 'opener' page once the payment process is complete.

My problem is that there are 2 or 3 stages on the payment processor side, and once that is complete they allow you to load a custom URL.

I want to load a blank page that will simply call a javascript function that closes the popup and moves the original mainpage onto another URL.

I have tried using a javscript function like Window.opener to refer to the main page, but this will not work as the window originally opened by the mainpage is no longer there and the success page is a descendant of that original page.

How can I communicate between the pop up and the Original main page given these restrictions?

Answers:

Answer

Ahhh! rookie mistake.

I was trying to access functions on my opening page by calling:

Window.opener.myCustomFunction()

Window is case sensitive and should have read:

window.opener.myCustomFunction()

Where myCustomFunction() was defined like this on my original opening page:

    window.myCustomFunction = function(){ 
       // My Code here
     }

defining my function like this ensured that it was a public function.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.