This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature.
Explainer
Move back and forward between your page history! All you need is access to the window global object then call history.forward()
or history.back()
, but you can also jump to a specific index with history.go(2)
, use history.length
to see the total of entries.
Additional Context
I picked this one for the challenge because I knew it would not be very complex to write in a tutorial format. I used MDN as reference and charactercountonline to count the characters while composing the text.
I hope this packs enough info to actually help you learn about the history API, it is indeed that simple.
Cover Art created with GIMP
Photo by Suzy Hazelwood at Pexels
Thanks for reading!