For Browsers that are not running JavaScript you should provide an alternative. The solution is simple. In the head of the page put:
<noscript>your message </noscript>
You can redirect the viewer to a page that does not use JavaScript, e.g.
<noscript>Perhaps you do not want to use Javascript. If so, go to <a href="nojs.htm">this page</a>.</noscript>
Back link
Here is a simple piece of JavaScript to attach to your Back button or as here, to a simple 'Back' link:
<a href="#" onclick="MM_callJS('if (history.length > 0){history.back()}')">Back</a>
The first part of the Javascript checks that there is something to go back to first. If there is, the JavaScript command history.back() runs. For those who want to know exactly what is happening, the history object is actually window.history, but the window object is implicit.
Forward
This can be adapted to a Next link using the history.forward() object. But I think this is frustrating if users believe this is leading them somewhere but find that it doesn't actually take them to the next place they are expected to go.