Help with popup window title

Discussion in 'Javascript' started by Targa, Oct 22, 2004.

  1. Targa

    Targa Guest

    Im using the code below to pop up a window: It works fine except for that in
    the titlebar, my domain name is listed before the page title like below:

    http://mydomain.com - MyPopupwindowname - Microsoft Internet Explorer

    Is there any way to remove this or otherwise control what is displayed in
    the titlebar? I just want it to display the page title - thats it. I dont
    really care about the MSIE but I mainly dont want the domain to display.

    Thanks in advance!

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "',
    'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=520,height=500,left
    = 245,top = 262');");
    }
    // End -->
    </script>


    <a href="javascript:popUp('MyWindow.asp')">Click Here</a>
    Targa, Oct 22, 2004
    #1
    1. Advertising

  2. Targa

    Randy Webb Guest

    Targa wrote:

    > Im using the code below to pop up a window: It works fine except for that in
    > the titlebar, my domain name is listed before the page title like below:
    >
    > http://mydomain.com - MyPopupwindowname - Microsoft Internet Explorer
    >
    > Is there any way to remove this or otherwise control what is displayed in
    > the titlebar? I just want it to display the page title - thats it. I dont
    > really care about the MSIE but I mainly dont want the domain to display.


    I don't get that behavior in IE6 SP2 with your code.

    > Thanks in advance!
    >
    > <SCRIPT LANGUAGE="JavaScript">


    <script type="text/javascript">

    The type attribute is mandatory in HTML4, and the language attribute is
    deprecated.

    > <!-- Begin


    Script hiding is no longer needed.

    > function popUp(URL) {
    > day = new Date();
    > id = day.getTime();


    So far, iffy. But its getting worse faster.

    > eval("page" + id + " = window.open(URL, '" + id + "',
    > 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=520,height=500,left
    > = 245,top = 262');");


    Two problems with that line of code:

    1) The un-needed eval.

    http://jibbering.com/faq/#FAQ4_40

    The only purpose I can think of to do what you are trying to do is to
    ensure you have a unique window by giving it a unique window name. The
    variable "page" + id can be generated using window["page" + id]

    2) The attributes section of the window.open call (the third parameter)
    can not contain spaces.

    And a note:

    Any attribute that is set to its default setting can be omitted in the
    parameters. You don't have to specify resizable=1.

    What you end up with is this:

    window["page" + id] = window.open(URL, id, 'parameters here')


    > }
    > // End -->


    Script hiding is no longer needed.

    > </script>
    >
    >
    > <a href="javascript:popUp('MyWindow.asp')">Click Here</a>


    Read the FAQ, section 4.24

    http://jibbering.com/faq/#FAQ4_24


    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq
    Randy Webb, Oct 22, 2004
    #2
    1. Advertising

  3. Targa

    DU Guest

    Randy Webb wrote:
    [snipped]

    >
    >> eval("page" + id + " = window.open(URL, '" + id + "',
    >> 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=520,height=500,left
    >> = 245,top = 262');");

    >


    [snipped]

    > And a note:
    >
    > Any attribute that is set to its default setting can be omitted in the
    > parameters. You don't have to specify resizable=1.
    >


    On the contrary. He has to if/since there is a non-empty windowFeatures
    string.
    "When the sFeatures parameter is specified, the features that are not
    defined in the parameter are disabled."
    http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp

    > What you end up with is this:
    >
    > window["page" + id] = window.open(URL, id, 'parameters here')
    >


    then:

    window["page" + id] = window.open(URL, id,
    "scrollbars=1,resizable=1,width=520,height=500,left=245,top=262");

    Another note: top value will not be honored, will have to be adjusted
    because top + height are greater than the availHeight of most users'
    screen res. (800x600 and 1024x768): there is now a correction mechanism
    in Mozilla and MSIE 6 SP2 implemented to make sure that secondary
    windows are NOT offscreen, are always within the available work area for
    applications.
    The fact that now MSIE 6 SP2 allows users to force presence of statusbar
    also makes coding top and height values more restrictive, constraining.

    DU
    --
    The site said to use Internet Explorer 5 or better... so I switched to
    Mozilla 1.7.3 :)
    DU, Oct 22, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    516
  2. soonic
    Replies:
    11
    Views:
    1,771
    soonic
    Jul 27, 2011
  3. Jens Peter Hansen
    Replies:
    7
    Views:
    520
    Randy Webb
    Jun 19, 2004
  4. Raffi
    Replies:
    4
    Views:
    216
    Dr John Stockton
    Aug 12, 2004
  5. Russell
    Replies:
    2
    Views:
    277
    Russell
    Sep 13, 2004
Loading...

Share This Page