title window.open()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Clive Moore

    title window.open()

    In my web application I provide the user with a popup window to a rich
    text document by calling window.open(). My problem is that the title of
    the open window is something like
    http://localhost:8080/app/images/232334.rtf. Is it possible to set this
    title to something different. As Im loading what is basically a word
    document instead of a html document I can't set it in the page.

    Thanks
    Clive


    --
    Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
  • i-Safire

    #2
    Re: title window.open()

    There is no title property/attribute for window. The Title actually
    belong to document, so we can not modify the title on window.open().
    If you want, you can modify the title using
    onload="this.do cument.title='n ewtitle'"
    on the new window.

    (ref:phoenix398 017)

    Comment

    • i-Safire

      #3
      Re: title window.open()

      If you really need to modify the title of document in new window, try the following:

      <HTML>
      <script>

      var var_oTimer_Obj, var_oWinOpen_Ne w;
      function fun_mWinOpen()
      {
      var_oWinOpen_Ne w = window.open('ab out:blank');
      var_oTimer_Obj = window.setInter val("fun_mDoc_R eTitle('~~newTi tle~~')", 10);
      }

      function fun_mDoc_ReTitl e(prm_sDoc_NewT itle)
      { if (var_oWinOpen_N ew.document.rea dyState == 'complete')
      { var_oWinOpen_Ne w.document.titl e=prm_sDoc_NewT itle;
      window.clearInt erval(var_oTime r_Obj);
      }
      }

      </script>
      <input type=button value="open window" onclick="fun_mW inOpen()"></input>
      </HTML>

      (ref:phoenix398 017)

      Comment

      • Lee

        #4
        Re: title window.open()

        Clive Moore said:[color=blue]
        >
        >In my web application I provide the user with a popup window to a rich
        >text document by calling window.open(). My problem is that the title of
        >the open window is something like
        >http://localhost:8080/app/images/232334.rtf. Is it possible to set this
        >title to something different. As Im loading what is basically a word
        >document instead of a html document I can't set it in the page.[/color]

        Depending on the browser in use and how it's configured, there's
        a very good chance that the document won't open in a browser window
        at all, but in a separate Word application window.

        However, in those situations where it will open in a browser window,
        you should be able to use this code, to open it in a frame of a new
        window whose title you can set:


        function showDoc(URL){
        globalHTML="<ht ml><head><title >Something Different</title></head>"
        +"<frameset rows='100%,*'>< frame src='"+URL+"'></frame>"
        +"</frameset></html>";
        window.open("ja vascript:opener .globalHTML","m yPOPUP");
        }

        Comment

        • Lee

          #5
          Re: title window.open()

          i-Safire said:[color=blue]
          >
          >If you really need to modify the title of document in new window, try the
          >following:
          >
          ><HTML>
          ><script>
          >
          >var var_oTimer_Obj, var_oWinOpen_Ne w;
          >function fun_mWinOpen()
          >{
          > var_oWinOpen_Ne w = window.open('ab out:blank');
          > var_oTimer_Obj = window.setInter val("fun_mDoc_R eTitle('~~newTi tle~~')", 10);
          >}
          >
          >function fun_mDoc_ReTitl e(prm_sDoc_NewT itle)
          >{ if (var_oWinOpen_N ew.document.rea dyState == 'complete')
          > { var_oWinOpen_Ne w.document.titl e=prm_sDoc_NewT itle;
          > window.clearInt erval(var_oTime r_Obj);
          > }
          >}
          >
          ></script>
          ><input type=button value="open window" onclick="fun_mW inOpen()"></input>
          ></HTML>[/color]

          No offense meant, but I would really hate to have to read
          much code using that naming convention.

          It leaves no doubt about what every identifier is, but at
          the cost of destroying the readability of the code.

          If the code is written well, and meaningful names chosen
          and appropriately documented, I shouldn't ever have any
          question about the identifiers, anyway.

          For example, if you name your functions "openNewWindow( )"
          and "retitleDocumen t()", the simple fact that they are verbs
          tells the reader that they are functions.

          Comment

          • Clive Moore

            #6
            Re: title window.open()

            Thanks for your reply Lee

            Your tip works ok apart from the fact that the word menus within ie are
            no longer available. For example i am unable to forward the rtf
            document as
            an e-mail.

            Any other ideas?

            Thanks
            Clive
            [color=blue]
            > Clive Moore said:[/color]
            [color=blue]
            >
            >
            > function showDoc(URL){
            > globalHTML="<ht ml><head><title >Something Different</title></head>"
            > +"<frameset rows='100%,*'>< frame src='"+URL+"'></frame>"
            > +"</frameset></html>";
            > window.open("ja vascript:opener .globalHTML","m yPOPUP");
            > }[/color]




            --
            Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

            Comment

            Working...