how to know user have opend window for firefox?

"george.tovrea" <[email protected]> Thu, 4 Mar 2010 21:29:33 +0800
Newsgroups gmane.comp.mozilla.devel.java
Message-ID <[email protected]>
hi all,

how to know user have open a window?

i want to active firstUse function when user open window first time ,but
it's won't invoke firstUse function  when user open the second window
without close the first one window .

it's my code :

var popup = {

    count: 0,

    firstUse: function() {

        alert("running this function");

    },

    open: function() {

        this.count++;

        if (typeof(this.firstUse) == "function") {

            this.firstUse();

            this.firstUse = null; // destroy method

        }

        alert("this is your " + this.count + " window ");

    }

};

window.addEventListener('load', function () {popup.open();}, false);

 

but it's still run firstUse function every time when I open a new window.

Any tip ?

 

 

Cheers,