Pop-up browser back to parent browser after reaching specific page

I have a popup (which I used as needed) that opens when I click a link. I have a user going through a series of pages selecting attributes to then send them to the trash.

My problem: after the user reaches the end of the selection process, I want to kill the popup and send the request back to the original browser (parent) so that the user can check.

Any idea how I would do this?

+4
source share
3 answers

Javascript: in the child window (popup).

window.opener.location = 'page.html"; window.close(); 

Is this what you are looking for?

+4
source

Access to the parent window can be obtained using the "opener" in JavaScript. Example:

 window.opener.title='hello parent window'; 

or

 window.opener.location.href='http://redirect.address'; 
+3
source

Script in my child form:

 <script language="JavaScript" type="text/javascript"> function SetData() { // form validation // var frmvalidator = new Validator("myForm"); // frmvalidator.addValidation("name","req","Please enter Account Name"); // get the new dialog values var str1 = document.getElementById("name").value; var winArgs = str1; // pass the values back as arguments window.returnValue = winArgs; window.close(); document.myForm.submit(); } </script> 

Script in my parent form:

 <% @account_head= current_company.account_heads.find_by_name("Sundry Debtors")%> <script type="text/javascript"> function OpenDialog() { var winSettings = 'center:yes;resizable:no;help:yes;status:no;dialogWidth:450px;dialogHeight:200px'; // return the dialog control values after passing them as a parameter winArgs = window.showModalDialog('<%= "/accounts/new?account_head_id=#{@account_head.id} #man" %>', winSettings); if(winArgs == null) { window.alert("no data returned!"); } else { // set the values from what returned document.getElementById("to_account_auto_complete").value = winArgs; } } </script> 

This is work, but not the way I want, anyone, if they find a good solution, suggest it.

0
source

All Articles