Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Access Window

The window object represents the Window of the Thunderbird application as well as the currently opened tabs. You can do many things with the window object, such as accessing the height or width of the window/tab or setting its title, registering timer events and much more. The Window API will give you the complete details. Since window is a global variable you can use it directly from your JavaScript file.

Check if the window is a tab or the root window

window.addEventListener("load", function(e) {
    alert("Is root?: " + isRoot());
}, false);

function isRoot() {
	if(window != window.top) return "false";
	else return "true";
} 

The example above tells you if the window object is a reference of the application window or of one of it is a tabs.

Register a timer

window.setInterval(
    function() {
        alert('foobar');
    }, 60000); //execute the function once very minute

If you periodically need to perform a certain action then you can use the setInterval function, it will then call this function every x milliseconds, in this case every 60000ms or one minute.

Document Tags and Contributors

 Contributors to this page: wbamberg, Lanoxx, jllogan
 Last updated by: wbamberg,