Stewie Griffin Stewie Griffin - 1 year ago 65
Javascript Question

Set title in the window popup

Is it possible to set a title in the window popup?

I have this in javascript:

var popup ='......');
popup.document.title = "my title";

but this does not work..still can't see any title

EDIT: the page popup is displaying is .aspx and it HAS a title tag, but still can't see that on the popup window..

Answer Source

Since popup.onload does not seem to work, here is a workaround:

var win ='', 'foo', ''); // open popup

function check() {
    if(win.document) { // if loaded
        win.document.title = "test"; // set title
    } else { // if not loaded yet
        setTimeout(check, 10); // check in another 10ms

check(); // start checking