JavaScript event.newURL Property
You are Here:
JavaScript event.newURL Property
The event.newURL
property returns the new URL to which the window is navigating.
Note: This is read-only property.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body onhashchange="myFunction(event)">
<h3 id="html">Learn HTML</h3>
<h3 id="css">Learn CSS</h3>
<h3 id="javascript">Learn Javascript</h3>
<h3 id="jquery">Learn Jquery</h3>
<h3 id="ajax">Learn AJAX</h3>
<a href="#css">Move to CSS</a>
<a href="#javascript">Move to Javascript</a>
<a href="#html">Move to HTML</a>
<script>
function myFunction() {
alert("newURL: "+event.newURL+"\n\noldURL: "+event.oldURL);
}
</script>
</body>
</html>
Syntax
event.newURL
Return Values
Value | Explanation |
---|---|
String | Returns a string representing the URL that was navigated to. |
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.