Forum Moderators: open

Message Too Old, No Replies

Changing title bar text of popup window

         

adb64

2:34 pm on Feb 1, 2006 (gmt 0)

10+ Year Member



Hello,

On one of my pages I have a link to a QuickTime movie that is to be opened in a new window using JavaScript. It directly opens the movie in the window, not as an embedded object in a HTML page. In the window title bar I want to put a short descriptive name of the movie and not its URL which seems the default text for the title bar, I am using the following script:


function OpenMovie(MovUrl)
{
MovWin = window.open(MovUrl, "movie", "width=360,height=280");
MovWin.document.title = "Movie Window Title";
}

And in my page I have this:


<a href="#" onclick="OpenMovie('MyMovie.mov'); return false;">See movie</a>

But this won't work. I also used a setTimeout() call to delay the update of the title with about a second. This only works partly in FF (URL stays, title is put after URL and before browsername) and not in IE.
Does someone have any idea how to change the titlebar text of a window?

Thanks,
Arjan

rocknbil

8:21 am on Feb 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another newcomer! Welcome aboard! :-D

Well, one way would be to write the document:

function OpenMovie(MovUrl, title)
{

var day = new Date();
var id = day.getTime();

MovWin = window.open('', id, "width=360,height=280,resizable,scrollbars");
mw_content = '<html><head><title>'+title+'<\/title>\n'+
'<\/head><body><object>\n'+
//(...... I'd have to chase down the exact object
//tag markup here, sorry, but write out the
//object tag using the passed MovUrl......)
'<param name="movie" value="'+MovUrl+'">\n'+
'<\/object><\/body><\/html>\n\n';
MovWin.document.write(mw_content);
MovWin.document.close();

}

If you can't allow yourself to allow scrollbars, I suggest at least always including the resizable attribute. You never know your users' environment. :-)

The little trick I've pulled with ID- this insures your info always opens in a NEW window instead of populating the same window that may now be behind the main window. People click and your content loads in the window named "movie" but can't see it.

adb64

2:12 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



rocknbil thanks,

I was only hoping there is a way to change the title text without using an HTML page with an embedded object and only open the movie file directly in the new window.

Arjan

DrDoc

5:41 am on Feb 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nope, that's the only way you can do it.