blob: 5633fa3df9918f3fda34a91ba9c1c9deae67a839 (
plain)
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
|
<!DOCTYPE html>
<html>
<head>
<title>window.location test</title>
<style>
#set_href { background-color: red; color: yellow; }
#reload { background-color: blue; color: #ccc; }
</style>
</head>
<body>
<pre></pre>
<div id="set_href">Click me to set location.href!</div>
<div id="reload">Click me to call location.reload()!</div>
<script>
var pre = document.querySelector("pre");
pre.innerHTML += "href: " + location.href + '\n';
pre.innerHTML += "protocol: " + location.protocol + '\n';
pre.innerHTML += "host: " + location.host + '\n';
pre.innerHTML += "hostname: " + location.hostname + '\n';
pre.innerHTML += "pathname: " + location.pathname+ '\n';
pre.innerHTML += "hash: " + location.hash + '\n';
pre.innerHTML += "search: " + location.search + '\n';
document.getElementById("set_href").addEventListener("mousedown", function() {
window.location.href = 'http://serenityos.org/';
});
document.getElementById("reload").addEventListener("mousedown", function() {
window.location.reload();
});
</script>
</body>
</html>
|