I am struggling over here with a simple problem in javascript.
what I want to do:
1. open a popup(p1) from main page.
2. open another popup(p2) from first popup(p1).
3. now I want to open popup from p2 in p1’s tab.
I am using following code:
var test = null;
// open first popup(p1) from main page
function openpopup1(URL,id) {
test = eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=850,height=650,left = 520,top = 300');");
}
// open second popup(p2) from p1 popup
function openpopup2(URL,id){
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=650,height=300,left=650,top = 280');");
}
// now open popup into p1's tab from p2 popup
function openpopupTop1stab(){
var newTab = window.open("tab.html");
window.test.opener(newTab);
// this code is not working
}
How can I solve this problem?
That is not possible. JavaScript has no concept of “tabs”. It’s purely the browser’s (or due to browser configuration the user’s) decision how to display a “window” opened with
window.open.