JavaScript event.oldURL Property

You are Here:

JavaScript event.oldURL Property

The event.oldURL property returns the old (previous) URL from which the window was navigated.

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.oldURL

Return Values

ValueExplanation
StringReturns a string representing the URL that was navigated from.

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.

Share this Page

Meet the Author