View Full Version : help with script opening a new window
davehaz
02-01-2006, 04:42 PM
howdy,
I am not a javascript guy, but know enough to use them when I need to,
can someone please take a look at this script and tell me what I need to do to have it open in a new window?
<SCRIPT LANGUAGE=\"JavaScript\"> window.location=\"http://www.somewhere.com/navsearch.htm?search=$search\";
</script>
tia.
A1ien51
02-01-2006, 04:54 PM
var newWin = window.open("theURL")
But the problem you will face is it will be blocked since you are not opening it with a click.
Eric
davehaz
02-01-2006, 04:57 PM
i am actually using php's echo to open it. would the whole script be like this?
<SCRIPT LANGUAGE=\"JavaScript\"> var newWin window.open=\"http://www.somewhere.com/navsearch.htm?search=$search\";
</script>
thanks.
A1ien51
02-01-2006, 05:07 PM
looks different that what I showed you....
You need to have the () with the srting (URL) inside of it.
Eric
Bill Posters
02-01-2006, 06:18 PM
i am actually using php's echo to open it.
I don't think so. (which is to say that I've not heard of any PHP that can open a new window or get around auto-popup blockers.)
would the whole script be like this?
<SCRIPT LANGUAGE=\"JavaScript\"> var newWin window.open=\"http://www.somewhere.com/navsearch.htm?search=$search\";
</script>
thanks.
Fwiw, ...
echo '<script type="text/html"> var newWin = window.open("http://www.somewhere.com/navsearch.htm?search=$search");
</script>'
However, the same point about blocking still stands.
As you're still not triggering the new window by a manual user action (onclick, onkeypress, etc...), popup blockers are likely to block its creation.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.