JavaScriptで戻るボタンを使えるようにするjQueryプラグイン

(function (jQuery){
    jQuery.history = this;

    this.init = function(){
        this.loc;

        if(jQuery.browser.msie){
            this.iframe = $('<iframe>').hide();
            $("body").append(this.iframe);
            var iframe = this.iframe.get(0).contentWindow.document;
            iframe.open();
            iframe.close();
            this.loc = iframe.location;
        } else {
            this.loc = location;
        }

        this.checkinterval = 100;
        this.histories = [];
        this.def = Number(this.loc.hash ? this.loc.hash.replace('#', '') : 0);
        this.current = def;
        this.mvflag = false;
        this.dontcheck = false;

	    setInterval((function(self){
            return function(){
                self.check();
            }
        })(this), this.checkinterval);
    };

    this.push = function(callback){
        if(this.mvflag){ this.mvflag = false; return; }
        if( !this.histories[this.def] )
            this.histories[this.def] = callback;
        else{
            this.dontcheck = true;

            if(jQuery.browser.msie){
                var iframe = this.iframe.get(0).contentDocument || this.iframe.get(0).contentWindow.document;
                iframe.open();
                iframe.close();
            }
            this.histories[++this.current] = callback;
            this.loc.hash = '#' + this.current;
            this.dontcheck = false;
        }
    };

    this.check = function(){
        if( this.dontcheck ) return;
        var number = Number(this.loc.hash.replace('#', ''));
        if( number != this.current ){
//            $.jGrowl((number > this.current ? 'forward' : 'back') + '... '+ this.current+ '->'+ number);
            this.current = number;
            if(this.histories[number]){
                this.mvflag = true;
                (this.histories[number])();
            }
        }
    };

    return jQuery;    
})(jQuery);

使用法はまたこんど書く。