4

I want using JavaScript to see if there is history or not

I mean if the forward button is available on the browser or not

How can I do it?

moses toh
  • 12,344
  • 71
  • 243
  • 443

1 Answers1

0

Sorry I can't add a comment, but there's a good discussion in the following link: How to check if the user can go back in browser history or not which I think is very similar, and indicates that you can't.

Edit: The only way I found is calling history.forward() and check if it returns undefined, although obviously, it would move the user forward if it was possible, and this is probably not really effective depending on your use case!

Baha
  • 388
  • 3
  • 12
  • 1
    I had read it. It's no help me. My question is different. I want to check if the forward button disable or no – moses toh Dec 14 '17 at 05:26
  • @mosestoh I edited the answer, although this is the only way I found, it's not effective. – Baha Dec 14 '17 at 06:24