Window history.back() metoden
- Föregående sida back()
- Nästa sida forward()
- Gå tillbaka till föregående nivå Window History
Definition and usage
history.back()
The method loads the previous URL (page) from the history list.
history.back()
The method is only valid when there is a previous page.
Note:
history.back()
With history.go(-1)
Same.
history.back()
Same as clicking the browser's 'Back' button.
See also:
Example
Create a back button on the page:
<button onclick="history.back()">Back</button>
The output of the above code will be:
Click back to see how it works.
(Only valid when there is a previous page in your history list)
Syntax
history.back()
Parameter
None.
Return value
None.
Browser support
All web browsers support history.back():
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Stöd | Stöd | Stöd | Stöd | Stöd | Stöd |
- Föregående sida back()
- Nästa sida forward()
- Gå tillbaka till föregående nivå Window History