In JS I am using :
window.open('index.php?module=Contacts&action=UD_lookupemailtemplates&tempmode=userdefined&temp_url='+encodeURIComponent(temp_php_url),'emailtemplate','top=100,left=200,height=400,width=500,resizable=yes,scrollbars=yes,menubar=no,addressbar=no,status=yes')
To open a small window which has few links. Now on the click on any one link an id will be attached to the a url and then I used this :
window.document.location.href = url;
This is also in JS. what this does is that it changes the contents of the small popup window but I need it to close the popup window and open this url in the main parent window from where the popup was created.
Is that possible ?
In JS I am using :
window.open('index.php?module=Contacts&action=UD_lookupemailtemplates&tempmode=userdefined&temp_url='+encodeURIComponent(temp_php_url),'emailtemplate','top=100,left=200,height=400,width=500,resizable=yes,scrollbars=yes,menubar=no,addressbar=no,status=yes')
To open a small window which has few links. Now on the click on any one link an id will be attached to the a url and then I used this :
window.document.location.href = url;
This is also in JS. what this does is that it changes the contents of the small popup window but I need it to close the popup window and open this url in the main parent window from where the popup was created.
Is that possible ?
4 Answers
Reset to default 3Suppose
var popup_window = window.open(...);
For closing this use
popup_window.close();
and to redirect the parent windows
window.parent.location.href = url;
To close a popup that you opened, store the return value from window.open
:
var popup = window.open(...);
Then, you can use:
popup.close();
I'm not clear based on your question where the URL variable is stored (in which window), but you can reference window variables in the popup via popup.variableName
.
First you have to redirect parent window using
window.opener.location.href = "http://url.";
and than close the current (popup) window
window.close();
Personaly I don't like pop up windows instead of that maybe yo can do the following:
You can open an overlay DIV that you can populate with data from "index.php?module=Contacts..." using AJAX and make links inside of that DIV that way so that by clicking them you close that overlay DIV and redirect page to what you want...