How do I add fallback functions for history.pushState() and window.onpopstate ? I need an if..else kind of logic. If the browser supports proceed, else I need an alternative logic. Even in some modern browsers it is not supported eg. in iPad. If not pushState, I need way to catch the back button click of the browser in JS without any having infinite loop.
history.js might help you. It emulates html5 history functionality on older browsers.
https://github.com/browserstate/history.js
If you don't wan't to use history.js you can probably use url hashes and the hashchange event to catch the back button clicks.