Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts

    changing popup window title

    I created a window using

    var win = window.open(URL, name, features) ;

    tried to do
    win.document.title = 'new title' ;


    got javascript 'Unspecified error'

    How am I suppose to change the title in javascript???
    Wayne Christian

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    It should work, what "features" have you specified?

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Possible fault is that you try and set the title before the document has loaded. Note I have never really tampered with popups so is just a guess.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That feature does not work in any of the Mozilla browsers. You can only reference the document.title.

  • #5
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Give this a shot:
    Code:
    try {
       // should work w/ IE
       win.document.title = 'new title'; 
    } catch (err) {
       try {
          // should work with Gecko
          win.defaultView.documentElement.title = 'new title';
       } catch (err2) {
             alert('I cannot set the title.');
       }
    }
    Sorry, forgot to close the tag.
    Last edited by Choopernickel; 03-19-2004 at 10:30 PM.

  • #6
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts
    unfortunately, I'm running currently on IE6. I'll try to delay the win.document.title and see if that works.
    Wayne Christian

  • #7
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay, if that won't work period, try this.

    Code:
    win = window.open(...);
    win.setTitle = setTitle;
    win.onload = function () {
       document.title = 'new title';
    }
    Maybe that'll work?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •