Search code examples
ajaxback-buttonbrowser-history

"Back button" - Native support for ajax


Its been a while since ajax has gone main stream with the most popular websites using it (in some or other form). Also, during this period, almost all major browsers have had more than one major release yet we do not see native support for the "Back Button", and handling the event on back button press in case of ajax based requests is left to scripting 'hacks'.

What are challenges in having native support for back button in case of Ajax for browsers? Why has it still not been implemented?


Solution

  • It seems some support is on the way in HTML5 with addition of following methods to the API:

    history.pushState();  
    history.replaceState();  
    window.onpopstate();  
    

    Well, its rather funny to answer your own question, but just in case some one came searching. Nevertheless, this is where I read about it.