You should add a little sanity check to your popstate
handler, and make sure that it doesn't do anything expensive if you "pop" into the same state you started in. Then you can not care about the browser, and instead just call your popstate on document ready:
$(function(){
$(window).on('popstate', popState);
// call popstate on document ready
$(popstate);
});
The answer suggesting you paste the code from $.browser
back into your environment is way overkill to support a bad practice. You can feature detect 99% of the things you need to. Almost every use of $.browser
is a dangerous. There are almost always ways to detect that.
The JavaScript community has been against browser sniffing for a long time. Here is a post from 2009 telling us why it's a bad idea. There are many others.
I beg you not to copy $.browser
back into your code, the jQuery team decided to kill it for a reason.