First, the example illustrates:
$ (' #btnOne '). Click (function () { varStateObject = {Id:1 }; vartitle = "Local Home"; varNewurl = '/index.html '; //modify addresses in the address bar /** instructions for use, cached address in pushstate, must be an address in the current domain */history.pushstate (stateobject, title, Newurl);}); $(' #btnTwo '). Click (function () { //Get Operation HistoryConsole.info (history.length);}); Window.addeventlistener (' Popstate ',function(event) {Console.info (event); Console.info (event.state); /** event.state.id get instructions, first open page without ID, will throw an exception */Console.info (event.state.id);});
Test Result: IE10 and above browser support, GOOGLE,FF support
HTML5 History One: http://www.cnblogs.com/tianma3798/p/5584541.html
HTML5 History object, JavaScript modifies the address bar without refreshing the page (ii)