Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Get History Length</title> </head> <body> <script> function getViews() { alert("You've accessed " + history.length + " web pages in this session."); } </script> <button type="button" onclick="getViews();">Get Views Count</button> </body> </html>