imjp
imjp

Reputation: 6695

pushState fallback for Internet Explorer?

I know that IE does not support pushState, but I want a way for my users with a modern browser to enjoy the benefits while the users using older browsers don't make use of it.

Currently, the javascript code prevents my tabbed navigation from working completely in IE, which means that cannot see a lot of the content.

Anyone know a solution for my problem?

Here's my JavaScript code:

var tabContents = $(".tab_content").hide(),
                  tabs = $(".tab_nav li");

tabs.first().addClass("active").show();
tabContents.first().show();

tabs.click(function() {
    var $this = $(this), 
        activeTab = $this.find('a').attr('href');
        history.pushState(null, '', activeTab);

    if(!$this.hasClass('active')){
        $this.addClass('active').siblings().removeClass('active');
        tabContents.hide().filter(activeTab).fadeIn();
    }

    return false;
});

$(window).bind('popstate', function(){
    $.getScript(location.href);
});

Upvotes: 6

Views: 6458

Answers (1)

knut
knut

Reputation: 4745

Try the jQuery BBQ: Back Button & Query Library. I've had great success using it.

Upvotes: 4

Related Questions