Using history.pushState
, we can change the current url using history API. Using popstate
function, we can get back to previous page. But while going back, I found that the forward link button in browser "Click here to go forward" gets disabled. Now, using history, I need to access that button's property.
How can we access the forward button's url using history API?
Are you manually popping the state? It sounds like it's getting removed.
To go back, you should be using history.back()
. history.back()
will preserve the entry in history so that you'll see the forward button enabled to go back forward.
You can also specify how many entries to go back with history.go(X)
. ex: history.go(-3)
will take you back three pages.
Source: MDN
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