Page 1 of 1
window.open redirects the parent window to domain.com/0
Posted: Tue Aug 08, 2006 5:02 pm
by daedalus__
I have this bit of JS:
Code: Select all
function load()
{
window.open("http://www.dancepropaganda.com/musicplayer/<?php echo preg_replace('/\s/', '_', $res['name']); ?>/player.html", width = 310, height = 250, status = 0, toolbar = 0, location = 0, menubar = 0, directories = 0, resizable = 0, scrollsbars = 0);
return true;
}
window.onload = load();
When it is run, the window pops up but then the window that popped it up is redirected to
http://www.domain.com/0
I do not understand why this is happening and cannot find anything about it on Google. :-/
Posted: Tue Aug 08, 2006 5:06 pm
by feyd
the width and height and all the rest of the properties need to all be in a single string.
Posted: Tue Aug 08, 2006 5:07 pm
by daedalus__
Thanks.
Posted: Tue Aug 08, 2006 5:21 pm
by daedalus__
It doesn't pop-up in IE, any suggestions? :-/
Posted: Tue Aug 08, 2006 5:52 pm
by feyd
I would imagine the popup blocker is blocking it, just like Firefox should too. I would suggest you let the user open the popup themselves, or use a ~floating div.
Posted: Tue Aug 08, 2006 11:01 pm
by daedalus__
/agree but the client thinks a pop-up window is best.
I've checked and checked and checked and no matter what I do, the attribute string will is not getting read correctly. I have to take it out entirely to get it to work in IE and FF. Oh well. :-/
Posted: Tue Aug 08, 2006 11:30 pm
by feyd
What's your new code?
Posted: Tue Aug 08, 2006 11:34 pm
by RobertGonzalez
Here is some
syntax information on window.open. How is the function being called? Is it through an onLoad event, or onClick event, or what? onClick inside of an anchor html tag has a tendency to refresh the page it is on, which can be a bear sometimes. But look first at the syntax for window.open, then look at how the function is being called and how that event might be doing to you what is happening to you.
Posted: Wed Aug 09, 2006 12:47 am
by daedalus__
Code: Select all
function popOnLoad(url)
{
window.open(url, 'width=310, height=250');
return true;
}
window.onload = popOnLoad("http://www.dancepropaganda.com/musicplayer/<?php echo $blah; ?>/player.html");
'width=310, height=250' doesnt work, having the attributes in any combination, wrapped in a string, doesn't work. It doesn't pop in IE and the attributes aren't read in FF. FF says 'invalid behavior' in the javascript console.
I also tried something like:
Code: Select all
function popOnLoad(url)
{
window.open(url, width=310, height=250, attr=val);
return true;
}
window.onload = popOnLoad("http://www.dancepropaganda.com/musicplayer/<?php echo $blah; ?>/player.html");
I think it had the same affect as above or didn't work in either browser.
EDIT: I actually decided to not worry about it to hard and am going to use a floating div when I have a moment to hack it up. I really just want this job to be done. :-/
Posted: Wed Aug 09, 2006 7:44 am
by feyd
window.open( string url, string windowName, string parameters);