This repository has been archived by the owner on May 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
27 lines (27 loc) · 1.59 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>getargs.js Example</title>
</head>
<body>
<h1>getargs.js Example</h1>
<ul>
<li><button onclick="alert(JSON.stringify(location.getargs));">Alert getargs</button></li>
<li><button onclick="location.getargs={'test': 'true', 'from': 'object'};">Set getargs to object</button></li>
<li><button onclick="location.getargs='?test=true&from=string';">Set getargs to string</button></li>
<li><button onclick="location.getargs=undefined;">Set getargs to undefined</button></li>
<li><button onclick="window.getargs.remove('test');">Remove 'test'</button></li>
<li><button onclick="window.getargs.options.pushState=true;location.getargs={'test': 'true', 'from': 'object', 'pushState': true};window.getargs.options.pushState=false;">Set getargs to object using history.pushState</button></li>
<li><button onclick="window.getargs.options.pushState=true;location.getargs='test=true&from=string&pushState=true';window.getargs.options.pushState=false;">Set getargs to string using history.pushState</button></li>
<li><button onclick="window.getargs.options.pushState=true;location.getargs=undefined;window.getargs.options.pushState=false;">Set getargs to undefined using history.pushState</button></li>
<li><button onclick="window.getargs.options.pushState=true;window.getargs.remove('test');window.getargs.options.pushState=false;">Remove 'test' using history.pushState</button></li>
</ul>
<script src="getargs.js"></script>
<script>
window.getargs.registerChangeHandler(function()
{
console.log("getargs has been changed to",window.getargs.get());
});
</script>
</body>
</html>