window.open does not work?

E

Edwin Boersma

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,height=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
 
D

DU

Edwin said:
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,height=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/appendix/notes.html#h-B.2.2

Common Validation Problems:
Ampersands (&'s) in URLs
http://www.htmlhelp.org/tools/validator/problems.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.

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=yes,scrollbars=yes,status=yes");

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

http://www10.brinkster.com/doctorunclear/Netscape7/Popup/PopupAndNetscape7.html

Example of re-using a requested popup window (all according to
accessibility and usability guidelines):
http://www10.brinkster.com/doctorunclear/BrowserBugsSection/Opera7Bugs/Opera7Bugs.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/doctorunclear/Netscape7/Netscape7Section.html
 
G

Grant Wagner

Edwin said:
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,height=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 <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_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-developer/upgrade_2.html
 
D

DU

Grant said:
Edwin Boersma wrote:




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 <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_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-developer/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/doctorunclear/Netscape7/Netscape7Section.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top