IE problem with open.window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anna Quick

    #1

    IE problem with open.window

    I am quite new to javascript, and don't seem to find the problem with
    stupid internet explorer.
    The script works fine in safari and mozilla.
    I searched the groups, but evidently put in the wrong keywords, didn't
    find the solution.
    It seems to be as easy as it gets: open a new window with a new url.
    in IE (I am using IE in mac osx), the error message is:

    Microsoft JScript runtime error:
    Line: 9
    Char: 8
    Error: Type mismatch

    Thanks for any tips! I am getting crazy over this!
    q.

    here are the scripts:

    test.js:
    function launchDisplay(m ydata) {
    datasetWindow=w indow.open("des cribe_data.cgi" + mydata, " ",
    "width=500,heig ht=200,scrollba rs=yes, resizable=yes")
    }

    test.html:
    <head><title>Un titled Document</title>
    <script language="JavaS cript" src="test.js"
    type="text/javascript"></script>
    </head><body><a HREF="#" onClick="launch Display('?datas et=mydataset');
    return false;">Display Properties of selected Dataset</a>
    <br />
    </body>
    </html>
  • DU

    #2
    Re: IE problem with open.window

    Anna Quick wrote:
    [color=blue]
    > I am quite new to javascript, and don't seem to find the problem with
    > stupid internet explorer.
    > The script works fine in safari and mozilla.
    > I searched the groups, but evidently put in the wrong keywords, didn't
    > find the solution.
    > It seems to be as easy as it gets: open a new window with a new url.
    > in IE (I am using IE in mac osx)[/color]

    IE for Mac OS X is a rare bird.

    , the error message is:[color=blue]
    >
    > Microsoft JScript runtime error:
    > Line: 9
    > Char: 8
    > Error: Type mismatch
    >
    > Thanks for any tips! I am getting crazy over this!
    > q.
    >
    > here are the scripts:
    >
    > test.js:
    > function launchDisplay(m ydata) {
    > datasetWindow=w indow.open("des cribe_data.cgi" + mydata, " ",
    > "width=500,heig ht=200,scrollba rs=yes, resizable=yes")[/color]

    Avoid an empty string for the window name. Avoid blank space in the 3rd
    parameter of the window.open (in the windowFeatures string list): this
    is an error for Netscape browsers.
    [color=blue]
    > }
    >
    > test.html:
    > <head><title>Un titled Document</title>
    > <script language="JavaS cript" src="test.js"[/color]

    language is deprecated while type is both backward and forward-compatible.
    [color=blue]
    > type="text/javascript"></script>
    > </head><body><a HREF="#" onClick="launch Display('?datas et=mydataset');[/color]

    The problem with this is that nothing happens (no document, no content
    at all) if javascript support is disabled. About 8-12% of users have
    javascript disabled. Your code here is not robust, not promoting
    accessibility to content.
    [color=blue]
    > return false;">Display Properties of selected Dataset</a>[/color]


    Try this:

    In your html:
    -------------
    <a href="describe_ data.cgi?datase t=mydataset" target="Request edPopup"
    onclick="launch Display(this.hr ef, this.target); return false;"
    title="Clicking this link will create a new window or will reuse an
    already opened window">Display Properties of selected Dataset <img
    src="http://www10.brinkster .com/doctorunclear/GRAPHICS/PNG/OpenRequestedPo pup.png"
    width="25" height="25" alt="[will create a new window]"></a>

    In your <script> in your <head>:
    --------------------------------

    <script type="text/javascript">
    var WindowObjectRef erence, strPreviousURL;
    function launchDisplay(s trCurrentURL, strTarget)
    {
    if(WindowObject Reference == null || WindowObjectRef erence.closed)
    {
    WindowObjectRef erence = window.open(str CurrentURL, strTarget,
    "width=500,heig ht=200,resizabl e,scrollbars,st atus");
    }
    else if(strPreviousU RL != strCurrentURL)
    {
    WindowObjectRef erence = window.open(str CurrentURL, strTarget,
    "width=500,heig ht=200,resizabl e,scrollbars,st atus");
    WindowObjectRef erence.focus();
    }
    else
    {
    WindowObjectRef erence.focus();
    };
    strPreviousURL = strCurrentURL;
    }
    </script>

    You can furthermore develop the accessibility, usability ideas of such
    script with cursor styling and make the new window coordinate positions
    and dimensions entirely scalable, proportional to the user's browser
    viewport.

    DU

    Comment

    • Anna Quick

      #3
      Re: IE problem with open.window

      DU,thanks for your help. Unfortunately, it still doesn't work.
      I tried it on a windows xp computer, and IE gave an error message as
      well.

      The html file I posted is actually a very reduced one generated by
      CGI.pm. I didn't do any browser checking/etc. yet, because I want to
      have the basic function in place first.

      The URL is:


      The debugging error message in IE (XP) is: invalid argument (pointing
      to the window.open line).


      below again the current version of the files. I am sure that it is
      something trivial that is wrong. Any help??? no problems with mozilla
      or safari.
      Thanks! q.

      test.html:
      <head><title>Da taset Test</title>
      <script src="test.js" type="text/javascript"></script>
      </head><body>
      <a HREF="/cgi-bin/describe_datase ts.cgi?dataset= testset"
      target="Dataset Description"
      onClick="launch Display('?datas et=testset'); return false;">Display
      Properties of selected Dataset</a>
      <br />
      </body>
      </html>

      test.js:
      var WindowObjectRef erence, strPreviousURL;
      function launchDisplay(d ataset_collecti on)
      {
      if(WindowObject Reference == null ||
      WindowObjectRef erence.closed) {
      WindowObjectRef erence =
      window.open("/cgi-bin/describe_datase ts.cgi" + dataset_collect ion,
      "Dataset Description",
      "width=500,heig ht=200,resizabl e,scrollbars,st atus");
      }
      else if(strPreviousU RL != dataset_collect ion) {
      WindowObjectRef erence =
      window.open("/cgi-bin/describe_datase ts.cgi" + dataset_collect ion,
      "Dataset Description",
      "width=500,heig ht=200,resizabl e,scrollbars,st atus");
      WindowObjectRef erence.focus();
      }
      else {
      WindowObjectRef erence.focus();
      };
      strPreviousURL = dataset_collect ion;
      }

      Comment

      • DU

        #4
        Re: IE problem with open.window

        Anna Quick wrote:[color=blue]
        > DU,thanks for your help. Unfortunately, it still doesn't work.
        > I tried it on a windows xp computer, and IE gave an error message as
        > well.
        >
        > The html file I posted is actually a very reduced one generated by
        > CGI.pm. I didn't do any browser checking/etc. yet, because I want to
        > have the basic function in place first.
        >
        > The URL is:
        > http://www.operartists.net/test.html
        >
        > The debugging error message in IE (XP) is: invalid argument (pointing
        > to the window.open line).
        >
        >
        > below again the current version of the files. I am sure that it is
        > something trivial that is wrong. Any help??? no problems with mozilla
        > or safari.
        > Thanks! q.
        >
        > test.html:
        > <head><title>Da taset Test</title>
        > <script src="test.js" type="text/javascript"></script>
        > </head><body>
        > <a HREF="/cgi-bin/describe_datase ts.cgi?dataset= testset"
        > target="Dataset Description"[/color]

        target attribute value MUST NOT have a blank space; otherwise it won't
        work in MSIE 6 for windows. That, I'm absolutely sure of. Use
        target="Dataset _Description" or
        target="Dataset Description"
        [color=blue]
        > onClick="launch Display('?datas et=testset');[/color]

        I recommend not making any concatenation operation when determining the
        URI. This is not recommendable.

        I'll examine your test.html page.

        DU

        return false;">Display[color=blue]
        > Properties of selected Dataset</a>
        > <br />
        > </body>
        > </html>
        >
        > test.js:
        > var WindowObjectRef erence, strPreviousURL;
        > function launchDisplay(d ataset_collecti on)
        > {
        > if(WindowObject Reference == null ||
        > WindowObjectRef erence.closed) {
        > WindowObjectRef erence =
        > window.open("/cgi-bin/describe_datase ts.cgi" + dataset_collect ion,
        > "Dataset Description",
        > "width=500,heig ht=200,resizabl e,scrollbars,st atus");
        > }
        > else if(strPreviousU RL != dataset_collect ion) {
        > WindowObjectRef erence =
        > window.open("/cgi-bin/describe_datase ts.cgi" + dataset_collect ion,
        > "Dataset Description",
        > "width=500,heig ht=200,resizabl e,scrollbars,st atus");
        > WindowObjectRef erence.focus();
        > }
        > else {
        > WindowObjectRef erence.focus();
        > };
        > strPreviousURL = dataset_collect ion;
        > }[/color]

        Comment

        • DU

          #5
          Re: IE problem with open.window

          Anna Quick wrote:
          [color=blue]
          > DU,thanks for your help. Unfortunately, it still doesn't work.
          > I tried it on a windows xp computer, and IE gave an error message as
          > well.
          >
          > The html file I posted is actually a very reduced one generated by
          > CGI.pm. I didn't do any browser checking/etc. yet, because I want to
          > have the basic function in place first.
          >
          > The URL is:
          > http://www.operartists.net/test.html
          >
          > The debugging error message in IE (XP) is: invalid argument (pointing
          > to the window.open line).
          >
          >
          > below again the current version of the files. I am sure that it is
          > something trivial that is wrong. Any help??? no problems with mozilla
          > or safari.
          > Thanks! q.
          >
          > test.html:
          > <head><title>Da taset Test</title>
          > <script src="test.js" type="text/javascript"></script>
          > </head><body>
          > <a HREF="/cgi-bin/describe_datase ts.cgi?dataset= testset"
          > target="Dataset Description"
          > onClick="launch Display('?datas et=testset'); return false;">Display[/color]

          One 1 hand, you define the relative url of the referenced resource (the
          href value), on the other hand, you call a function which will
          concatenate string to establish the url value. This is not recommendable
          and should be avoided. In the code I gave you, I edited the relative url
          as the href value and then use this.href for the called function
          launchDisplay. Not only this is better but it also help code
          maintenance: you only have 1 string to update.
          And I still maintain the rest I said in the other post: no blank space
          in the target attribute value, do not concatenate strings when making
          the window.open() call.
          The complete code I provided should work in case the user has javascript
          disabled.
          For the sake of this, try your MSIE for Mac at this page:



          You may try other pages in my javascript section which uses requested
          popups. Let me know which pages which do not work.

          DU
          [color=blue]
          > Properties of selected Dataset</a>
          > <br />
          > </body>
          > </html>
          >
          > test.js:
          > var WindowObjectRef erence, strPreviousURL;
          > function launchDisplay(d ataset_collecti on)
          > {
          > if(WindowObject Reference == null ||
          > WindowObjectRef erence.closed) {
          > WindowObjectRef erence =
          > window.open("/cgi-bin/describe_datase ts.cgi" + dataset_collect ion,
          > "Dataset Description",
          > "width=500,heig ht=200,resizabl e,scrollbars,st atus");
          > }
          > else if(strPreviousU RL != dataset_collect ion) {
          > WindowObjectRef erence =
          > window.open("/cgi-bin/describe_datase ts.cgi" + dataset_collect ion,
          > "Dataset Description",
          > "width=500,heig ht=200,resizabl e,scrollbars,st atus");
          > WindowObjectRef erence.focus();
          > }
          > else {
          > WindowObjectRef erence.focus();
          > };
          > strPreviousURL = dataset_collect ion;
          > }[/color]

          Comment

          Working...