traven
01-08-2007, 08:05 AM
I have a JS function in my web page that receives a url variable.
This web page is a pop up window with some news. When i click in one single news, it calls the js function.
I want to detect if there's no window opened, then open a new window with the url in the parameter of the function. Other than that, if there's any browser opened window, then it reloads that window with the new url.
how can i do that?
function abrirMateriaPop(elementoId,url)
{
if(!window.opener || window.opener.closed)
{
window.open('http://www.globo.com');
}
else
{
window.opener.location.href='http://www.globo.com';
}
}
It works in IE but doesn´t in firefox 2.0
Also, If the user open a new IE window (in case of IE test), this is not counted as an active window.
This web page is a pop up window with some news. When i click in one single news, it calls the js function.
I want to detect if there's no window opened, then open a new window with the url in the parameter of the function. Other than that, if there's any browser opened window, then it reloads that window with the new url.
how can i do that?
function abrirMateriaPop(elementoId,url)
{
if(!window.opener || window.opener.closed)
{
window.open('http://www.globo.com');
}
else
{
window.opener.location.href='http://www.globo.com';
}
}
It works in IE but doesn´t in firefox 2.0
Also, If the user open a new IE window (in case of IE test), this is not counted as an active window.