mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
LibWeb: Allow reloading the current page with location.reload()
This commit is contained in:
parent
71007f6ebb
commit
3b11e471bd
5 changed files with 32 additions and 3 deletions
|
@ -3,12 +3,14 @@
|
|||
<head>
|
||||
<title>window.location test</title>
|
||||
<style>
|
||||
#clickme { background-color: red; color: yellow; }
|
||||
#set_href { background-color: red; color: yellow; }
|
||||
#reload { background-color: blue; color: #ccc; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre></pre>
|
||||
<div id="clickme">Click me to navigate away!</div>
|
||||
<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.querySelectorAll("pre")[0];
|
||||
pre.innerHTML += "href: " + location.href + '\n';
|
||||
|
@ -19,9 +21,13 @@
|
|||
pre.innerHTML += "hash: " + location.hash + '\n';
|
||||
pre.innerHTML += "search: " + location.search + '\n';
|
||||
|
||||
document.getElementById("clickme").addEventListener("mousedown", function() {
|
||||
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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue