diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-18 21:52:50 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-18 21:52:50 +0200 |
commit | efdfdbabdbef1354424d0d9aafac232ee2dc17a0 (patch) | |
tree | e2220f75ccb61f61340edd1360a3b63680113661 /Base/home | |
parent | 1ec4db04cd4a04263c7081d95fbc804b2e610b42 (diff) | |
download | serenity-efdfdbabdbef1354424d0d9aafac232ee2dc17a0.zip |
LibWeb: Allow navigating to a new URL by setting window.location.href
Diffstat (limited to 'Base/home')
-rw-r--r-- | Base/home/anon/www/location.html | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Base/home/anon/www/location.html b/Base/home/anon/www/location.html index 61a42351c6..9405fd93fc 100644 --- a/Base/home/anon/www/location.html +++ b/Base/home/anon/www/location.html @@ -2,9 +2,13 @@ <html> <head> <title>window.location test</title> + <style> + #clickme { background-color: red; color: yellow; } + </style> </head> <body> - <pre></pre> + <pre></pre> + <div id="clickme">Click me to navigate away!</div> <script> var pre = document.querySelectorAll("pre")[0]; pre.innerHTML += "href: " + location.href + '\n'; @@ -12,6 +16,10 @@ pre.innerHTML += "pathname: " + location.pathname+ '\n'; pre.innerHTML += "hash: " + location.hash + '\n'; pre.innerHTML += "search: " + location.search + '\n'; + + document.getElementById("clickme").addEventListener("mousedown", function() { + window.location.href = 'http://serenityos.org/'; + }); </script> </body> </html> |