I want to use dynamic URL update through js script:
window.history.pushState("string", "Title", "/new-url");
But if browser is old and not supporing this function it should simply redirect to new URL.
Is there any simple way to check it ?
You simply check:
if (history.pushState) {
}
The easiest (and most performant):
if ('history' in window && 'pushState' in history) { // available
Still, I'd suggest using some established solutions for history management, like History.js.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With