-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
42 lines (34 loc) · 1.09 KB
/
Copy pathscript.js
File metadata and controls
42 lines (34 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// In this lesson we will learn about Web History API
let textOne = document.getElementById('textOne');
let viewDoc = document.getElementById('viewDoc');
viewDoc.addEventListener("click", () => {
let x = true;
if (x == true) {
textOne.innerHTML = `
<p>The Web History API provides easy methods to access the windows.history object.</p>
<p>The window.history object contains the URLs (Web Sites) visited by the user.</p>
<h1>There are three main types of History API</h1>
<li>back()</li>
<li>go(-2)</li>
<li>forward()</li>
<h2>Check the Examples Below with the .js files for better Understanding</h2>
<p style ="font-family: monospace; color: red;">This will work when we are having more than one web pages in a website</p>
`
x = false;
} else {
textOne.innerHTML.style.display = "none";
x = true;
}
})
// History back()
function DisplayTwo() {
window.history.back();
}
// History go()
function DisplayThree() {
window.history.go(-2);
}
// History forward()
function DisplayFour() {
window.history.forward();
}