diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-18 22:05:13 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-18 22:05:13 +0200 |
commit | 3b11e471bd5e796edd7311bed17c4ca14afc89a3 (patch) | |
tree | 26e5620aa7e6a471b0b99f28a247b76506c4ef04 /Base/home | |
parent | 71007f6ebbfe181472d82cd003698189974c6df2 (diff) | |
download | serenity-3b11e471bd5e796edd7311bed17c4ca14afc89a3.zip |
LibWeb: Allow reloading the current page with location.reload()
Diffstat (limited to 'Base/home')
-rw-r--r-- | Base/home/anon/www/location.html | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Base/home/anon/www/location.html b/Base/home/anon/www/location.html index fd04896897..d7e08fe5d4 100644 --- a/Base/home/anon/www/location.html +++ b/Base/home/anon/www/location.html @@ -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> |