Javascript and Netscape 4.7

C

Cenékemoi

Hello,

excuse me in advance for my poor english...

I have a problem with NS 4.7 (I know, it is old, but I have no
choice...) :

So, I have a page with a link to open a new window:

var strHtml = '<html><head><title>title_of_window</title>' +
'<LINK rel=stylesheet href=theme.css>'+
'<SCRIPT LANGUAGE="JavaScript" SRC="my_script.js"></SCRIPT>' +
'</HEAD><BODY onLoad="fonc_onLoad();" class=Body topmargin=0
leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0>' +
'blablabla' +
'</body></html>';

var win = window.open('', 'window_name', 'parameters');
win.document.write(strHtml);
win.document.close();
win.focus();


My problem concerns the tag "onLoad " of the "BODY" tag: with IE, the
"fonc_onLoad()" starts normally (this function is in "my_script.js"),
but with NS 4.7 (ou 4.51), the <SCRIPT> tag is ignored (you can view the
window's source code), so the "fonc_onLoad()" function cannot not start.

Any help would be highly appreciated.
Thank you very much in advance.
 
M

Martin Honnen

Cenékemoi said:
Hello,

excuse me in advance for my poor english...

I have a problem with NS 4.7 (I know, it is old, but I have no
choice...) :

So, I have a page with a link to open a new window:

var strHtml = '<html><head><title>title_of_window</title>' +
'<LINK rel=stylesheet href=theme.css>'+
'<SCRIPT LANGUAGE="JavaScript" SRC="my_script.js"></SCRIPT>' +
'</HEAD><BODY onLoad="fonc_onLoad();" class=Body topmargin=0
leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0>' +
'blablabla' +
'</body></html>';

var win = window.open('', 'window_name', 'parameters');
win.document.write(strHtml);
win.document.close();
win.focus();


My problem concerns the tag "onLoad " of the "BODY" tag: with IE, the
"fonc_onLoad()" starts normally (this function is in "my_script.js"),
but with NS 4.7 (ou 4.51), the <SCRIPT> tag is ignored (you can view the
window's source code), so the "fonc_onLoad()" function cannot not start.

Any help would be highly appreciated.
Thank you very much in advance.

Try to insert some dummy script e.g.
strHTML = '<html><head><title>...<\/title>'
+ '<script type="text/javascript">var dummy = 1;<\/script>'
+ '...'
that sometimes helps that NN4 recognizes your script
 
D

Dom Leonard

Salut de l'australie...
I have a problem with NS 4.7

I have a page with a link to open a new window:

var strHtml = '<html><head><title>title_of_window</title>' +
'<LINK rel=stylesheet href=theme.css>'+
'<SCRIPT LANGUAGE="JavaScript" SRC="my_script.js"></SCRIPT>' +

The first problem occurs here:
</SCRIPT>
will terminate parsing of the javascript block in which this code has
been written. It needs to be escaped to
'</HEAD><BODY onLoad="fonc_onLoad();" class=Body topmargin=0
leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0>' +
'blablabla' +
'</body></html>';

var win = window.open('', 'window_name', 'parameters');
win.document.write(strHtml);
win.document.close();
win.focus();

There are two more related problems that I know of:

a) When writing "<\/SCRIPT>" within generated content, it needs to be
the last thing written in a single call to document.write. If not, NS4
can produce layout errors. If necessary, break up strHTML into pieces
and write them separately. I can not say that this bug will affect your
page for sure, but the bug certainly exists.


b) NS4 has trouble loading external javascript files within pages
generated by pages loaded using the "file://" protocol. Testing this
page most likely needs to be done using a server.
(For testing on my local machine, I use Personal Web Server (PWS) under
Windows 98, or Appache under Windows XP.)


amicalement,

Dom
 
C

Cenékemoi

Bonjour (from France) à Dom Leonard
Salut de l'australie...

There are two more related problems that I know of:

a) When writing "<\/SCRIPT>" within generated content, it needs to
be the last thing written in a single call to document.write. If not,
NS4 can produce layout errors. If necessary, break up strHTML into
pieces and write them separately. I can not say that this bug will
affect your page for sure, but the bug certainly exists.

here, it is not necessary...
b) NS4 has trouble loading external javascript files within pages
generated by pages loaded using the "file://" protocol. Testing this
page most likely needs to be done using a server.

Thank you very much, you are right !...
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top