Frode Posted October 8, 2019 Report Share Posted October 8, 2019 Hi, I use the script below to close a popup window containing a submission form. On most occasions the script is fine as it is, as it closes the popup and refreshes the parent page (dashboard). There is however one occasion where my users will enter the popup from another page, but they should still be sent to the dashboard page when the popup close. How can the script be modified to work like that? Regards, Frode <script> function cb_close() { if (window.opener && !window.opener.closed) { window.opener.location.reload(); //window.opener.location.href = "url popup window"; } window.close(); var test= window.self; test.opener = window.self; test.close(); } setTimeout("cb_close()",1000); </script> Quote Link to comment Share on other sites More sharing options...
carlJS Posted October 10, 2019 Report Share Posted October 10, 2019 This line of code of yours should work. window.opener.location.href = "url popup window"; Do note that the value is interpreted as a relative path so you may want to specify a scheme/protocol if you want it to be an absolute URL e.g. https://www.mysite.com [src="carl.js"] Quote Link to comment Share on other sites More sharing options...
Frode Posted October 10, 2019 Author Report Share Posted October 10, 2019 Thank you carlJS, this works! Regards, Frode Quote Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.