469,273 Members | 1,786 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,273 developers. It's quick & easy.

window.open does not work?

Hi,

I've just installed Netscape 7.1 for Linux and the following script
refuses to open a window when I call this function:

function OpenLinkWindow() {

wMap=window.open('http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map=','','width=400,heigh t=600');
wMap.onResize =
'self.location.href=http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map='
wMap.focus();
self.close();
}

In other browsers (NS 7.0/Win98, IE6/Win98) and in Netscape 7.0 for
Linux, it works fine.

What has changed in 7.1?????
Rgds,
Edwin

Jul 20 '05 #1
3 9921
DU
Edwin Boersma wrote:
Hi,

I've just installed Netscape 7.1 for Linux and the following script
refuses to open a window when I call this function:

function OpenLinkWindow() {

wMap=window.open('http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map=','','width=400,heigh t=600');

One of the top most frequent validation errors is to forget to escape
ampersands in url strings.

B.2.2 Ampersands in URI attribute values
http://www.w3.org/TR/html401/appendi...s.html#h-B.2.2

Common Validation Problems:
Ampersands (&'s) in URLs
http://www.htmlhelp.org/tools/valida...blems.html#amp

height=600 will overflow the availHeight value on most scr. res.
(800x600, even 1024x768 ones) and will therefore trigger error
correction mechanisms to adjust the window size. Cpu, time, RAM will
unneedlessly be involved to reduce this 600px height to something shorter.
As coded, the window will not be resizable, will not have scrollbars if
he content overflows the actual, real window dimensions and will not
have status bar. Preventing resizing the window and removing scrollbars
when they are needed is counter-accessibility and anti-usability: they
both go against the best and most objective interests of the user and
the author; therefore this can not be recommendable.
wMap.onResize =
'self.location.href=http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map='
Not an event handler at all here. No function call; just an url.

wMap.focus();
Illogical.
self.close();
A window not opened by javascript can NOT be closed by javascript. So
the opener here must have been opened by javascript otherwise this
instruction will not be honored in NS 7.1 and will generate a security
warning in the javascript console.
}

In other browsers (NS 7.0/Win98, IE6/Win98) and in Netscape 7.0 for
Linux, it works fine.

What has changed in 7.1?????
Rgds,
Edwin


<script type="text/javascript">
var WindowObjectReference; // needs to be global
function OpenLinkWindow()
{
if(WindowObjectReference == null || WindowObjectReference.closed)
{
WindowObjectReference =
window.open("http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&amp;map=",
"RequestedPopup"',
"top=50,left=100,width=400,height=400,resizable=ye s,scrollbars=yes,status=yes");

}
else
{
WindowObjectReference.focus();
};
}
</script>

http://www10.brinkster.com/doctorunc...Netscape7.html

Example of re-using a requested popup window (all according to
accessibility and usability guidelines):
http://www10.brinkster.com/doctorunc...pera7Bugs.html

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #2
Edwin Boersma wrote:
Hi,

I've just installed Netscape 7.1 for Linux and the following script
refuses to open a window when I call this function:

function OpenLinkWindow() {

wMap=window.open('http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map=','','width=400,heigh t=600');
wMap.onResize =
'self.location.href=http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map='
wMap.focus();
self.close();
}

In other browsers (NS 7.0/Win98, IE6/Win98) and in Netscape 7.0 for
Linux, it works fine.

What has changed in 7.1?????

Rgds,
Edwin


I doubt very much it "works fine" in any browser. Events are all lower case in JavaScript, so wMap.onResize is simply
creating a new property and assigning your string value to it.

Even if you wrote:

wMap.onresize = 'whatever';

you're still assigning a string to the event, and you need to be assigning a function.

Maybe you meant:

wMap.onresize = function() {
self.location.href =
'http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map=';
}

?

However, even assuming you got the syntax for assigning the onresize event correct, there's still the matter that you are
potentially assigning wMap.onresize before it's content has even finished loading, at which point the <body ...
onresize="..."> event (if any) would overwrite your assignment. If there is no onresize event for the content you are
loading, then most likely your carefully crafted onresize event is simply being replaced by null.

If any of what you had above was working in any browser, then it was a bug in /that/ browser, not the current one.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #3
DU
Grant Wagner wrote:
Edwin Boersma wrote:

Hi,

I've just installed Netscape 7.1 for Linux and the following script
refuses to open a window when I call this function:

function OpenLinkWindow() {

wMap=window.open('http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map=','','width=400,heigh t=600');
wMap.onResize =
'self.location.href=http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map='
wMap.focus();
self.close();
}

In other browsers (NS 7.0/Win98, IE6/Win98) and in Netscape 7.0 for
Linux, it works fine.

What has changed in 7.1?????

Rgds,
Edwin

I doubt very much it "works fine" in any browser. Events are all lower case in JavaScript, so wMap.onResize is simply
creating a new property and assigning your string value to it.

Even if you wrote:

wMap.onresize = 'whatever';

you're still assigning a string to the event, and you need to be assigning a function.


Exactly.
Maybe you meant:

wMap.onresize = function() {
self.location.href =
'http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map=';
}

?

However, even assuming you got the syntax for assigning the onresize event correct, there's still the matter that you are
potentially assigning wMap.onresize before it's content has even finished loading, at which point the <body ...
onresize="..."> event (if any) would overwrite your assignment. If there is no onresize event for the content you are
loading, then most likely your carefully crafted onresize event is simply being replaced by null.

<body onresize="..."> is not HTML 4 valid anyway. AFAIK, only the
document and the window objects can have a resize event listener.

The OP's code is still nebulous, counter-productive and confusing. If an
resize event is triggered, then he wants to load the resource in the
opener, give focus to the popup and then close the opener.
If any of what you had above was working in any browser, then it was a bug in /that/ browser, not the current one.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html

--
DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.