PDA

View Full Version : Javascript popup function compatibility with browsers



poooh
08-21-2005, 12:23 PM
Hi..
Could someone tell me if the "popup" javascript function i used is compatible with all the internet browsers available like firefox,IE...etc..

plz reply asap...
Thnx

jscheuer1
08-21-2005, 01:24 PM
Which pop up did you use?

poooh
08-21-2005, 02:55 PM
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left = 192,top = 144');");
}

jscheuer1
08-21-2005, 03:38 PM
Works OK here in IE6 and FF and should be fine in most browsers. If a pop up of this sort is not launched as a direct result of a user's click, it often will be blocked by many browsers though. Here are two link codes I used to launch it:

<a href="javascript:popUp('some.htm')">Link Text</a>

<a href="some.htm" onclick="popUp(this.href);return false;">Link Text</a>Both of the above were not blocked as they require a user's direct click to activate. The second one has the advantage of loading the page in the current window if the user has no javascript available/active. This one:

<a href="some.htm" target="_blank" onclick="popUp(this.href);return false;">Link Text</a>Will launch the content in a regular new window if there is no javascript for the user.