Tell how many items are in the history stack with history.length in JavaScript
Description
The following code shows how to tell how many items are in the history stack with history.length.
Example
<!--from www. j a v a 2 s.c o m-->
<!DOCTYPE HTML>
<html>
<body>
<script>
if (history.length == 0){
document.writeln("0")
} else{
document.writeln("more than 0")
}
</script>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Browser History
Add an Entry to the Browser History with hi...
Go one step back with history.back() in Jav...
Go one step forward with history.forward() ...
Navigate through the user's history backwar...
Navigate to the first location in history t...
Add an Entry to the Browser History with hi...
Go one step back with history.back() in Jav...
Go one step forward with history.forward() ...
Navigate through the user's history backwar...
Navigate to the first location in history t...