mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibWeb: Allow navigating to a new URL by setting window.location.href
This commit is contained in:
parent
1ec4db04cd
commit
efdfdbabdb
5 changed files with 32 additions and 3 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue