window.open does not work?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Edwin Boersma

    #1

    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.ope n('http://naxos.orangepor t.net/cyclades-info/ShowMap.php?id_ advert=45&map=' ,'','width=400, height=600');
    wMap.onResize =
    'self.location. href=http://naxos.orangepor t.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

  • DU

    #2
    Re: window.open does not work?

    Edwin Boersma wrote:[color=blue]
    > 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.ope n('http://naxos.orangepor t.net/cyclades-info/ShowMap.php?id_ advert=45&map=' ,'','width=400, height=600');
    >[/color]

    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


    Common Validation Problems:
    Ampersands (&'s) in URLs


    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.
    [color=blue]
    > wMap.onResize =
    > 'self.location. href=http://naxos.orangepor t.net/cyclades-info/ShowMap.php?id_ advert=45&map='[/color]

    Not an event handler at all here. No function call; just an url.
    [color=blue]
    >
    > wMap.focus();[/color]

    Illogical.
    [color=blue]
    > self.close();[/color]

    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.
    [color=blue]
    > }
    >
    > 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
    >[/color]

    <script type="text/javascript">
    var WindowObjectRef erence; // needs to be global
    function OpenLinkWindow( )
    {
    if(WindowObject Reference == null || WindowObjectRef erence.closed)
    {
    WindowObjectRef erence =
    window.open("ht tp://naxos.orangepor t.net/cyclades-info/ShowMap.php?id_ advert=45&amp;m ap=",
    "RequestedPopup "',
    "top=50,left=10 0,width=400,hei ght=400,resizab le=yes,scrollba rs=yes,status=y es");

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



    Example of re-using a requested popup window (all according to
    accessibility and usability guidelines):


    DU
    --
    Javascript and Browser bugs:

    - Resources, help and tips for Netscape 7.x users and Composer
    - Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x


    Comment

    • Grant Wagner

      #3
      Re: window.open does not work?

      Edwin Boersma wrote:
      [color=blue]
      > 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.ope n('http://naxos.orangepor t.net/cyclades-info/ShowMap.php?id_ advert=45&map=' ,'','width=400, height=600');
      > wMap.onResize =
      > 'self.location. href=http://naxos.orangepor t.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[/color]

      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.h ref =
      'http://naxos.orangepor t.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 <gwagner@agrico reunited.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


      Comment

      • DU

        #4
        Re: window.open does not work?

        Grant Wagner wrote:
        [color=blue]
        > Edwin Boersma wrote:
        >
        >[color=green]
        >>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.o pen('http://naxos.orangepor t.net/cyclades-info/ShowMap.php?id_ advert=45&map=' ,'','width=400, height=600');
        >> wMap.onResize =
        >>'self.locatio n.href=http://naxos.orangepor t.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[/color]
        >
        >
        > 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.
        >[/color]

        Exactly.
        [color=blue]
        > Maybe you meant:
        >
        > wMap.onresize = function() {
        > self.location.h ref =
        > 'http://naxos.orangepor t.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.
        >[/color]

        <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.
        [color=blue]
        > 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 <gwagner@agrico reunited.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
        >
        >[/color]


        --
        DU
        --
        Javascript and Browser bugs:

        - Resources, help and tips for Netscape 7.x users and Composer
        - Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x


        Comment

        Working...