serenity/Base/res/html/misc/location.html

34 lines
1.2 KiB
HTML

<!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>