Javascript and Netscape 4.7

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cenékemoi

    Javascript and Netscape 4.7

    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><t itle>title_of_w indow</title>' +
    '<LINK rel=stylesheet href=theme.css> '+
    '<SCRIPT LANGUAGE="JavaS cript" SRC="my_script. js"></SCRIPT>' +
    '</HEAD><BODY onLoad="fonc_on Load();" class=Body topmargin=0
    leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0> ' +
    'blablabla' +
    '</body></html>';

    var win = window.open('', 'window_name', 'parameters');
    win.document.wr ite(strHtml);
    win.document.cl ose();
    win.focus();


    My problem concerns the tag "onLoad " of the "BODY" tag: with IE, the
    "fonc_onLoa d()" 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_onLoa d()" function cannot not start.

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

    --
    Yours sincerely, Thierry

  • Martin Honnen

    #2
    Re: Javascript and Netscape 4.7



    Cenékemoi wrote:
    [color=blue]
    > 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><t itle>title_of_w indow</title>' +
    > '<LINK rel=stylesheet href=theme.css> '+
    > '<SCRIPT LANGUAGE="JavaS cript" SRC="my_script. js"></SCRIPT>' +
    > '</HEAD><BODY onLoad="fonc_on Load();" class=Body topmargin=0
    > leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0> ' +
    > 'blablabla' +
    > '</body></html>';
    >
    > var win = window.open('', 'window_name', 'parameters');
    > win.document.wr ite(strHtml);
    > win.document.cl ose();
    > win.focus();
    >
    >
    > My problem concerns the tag "onLoad " of the "BODY" tag: with IE, the
    > "fonc_onLoa d()" 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_onLoa d()" function cannot not start.
    >
    > Any help would be highly appreciated.
    > Thank you very much in advance.[/color]

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

    --

    Martin Honnen


    Comment

    • Dom Leonard

      #3
      Re: Javascript and Netscape 4.7



      Salut de l'australie...

      Thierry wrote:
      [color=blue]
      > I have a problem with NS 4.7
      >
      > I have a page with a link to open a new window:
      >
      > var strHtml = '<html><head><t itle>title_of_w indow</title>' +
      > '<LINK rel=stylesheet href=theme.css> '+
      > '<SCRIPT LANGUAGE="JavaS cript" SRC="my_script. js"></SCRIPT>' +[/color]

      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
      <\/SCRIPT>
      even though it occurs within a quoted string.
      [color=blue]
      > '</HEAD><BODY onLoad="fonc_on Load();" class=Body topmargin=0
      > leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0> ' +
      > 'blablabla' +
      > '</body></html>';
      >
      > var win = window.open('', 'window_name', 'parameters');
      > win.document.wr ite(strHtml);
      > win.document.cl ose();
      > win.focus();
      >
      >[/color]

      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



      Comment

      • Cenékemoi

        #4
        Re: Javascript and Netscape 4.7

        Bonjour (from France) à Dom Leonard
        <doml.removethi s@senet.andthis .com.au> qui nous a
        écrit :[color=blue]
        > 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.[/color]

        here, it is not necessary...
        [color=blue]
        > 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.[/color]

        Thank you very much, you are right !...
        [color=blue]
        > (For testing on my local machine, I use Personal Web Server (PWS)
        > under Windows 98, or Appache under Windows XP.)
        >
        >
        > amicalement,
        >
        > Dom[/color]

        --
        Cordialement, Thierry ;-)

        Comment

        Working...