Share on Google+Share on Google+

JavaScript Navigate to URL

This page discusses - JavaScript Navigate to URL

JavaScript Navigate to URL


JavaScript provides several methods and properties which allow the user to navigate to the various locations. Here we are using the 'href' property of location object for this purpose. This will navigate the user to the specified location. Then we have created a link "Click here to Navigate RoseIndia home page". On clicking the link, the method navigateToURL() is called which navigates to the specified URL "".

Here is the code:

<h2>Navigate to URL</h2>
function navigateToURL() {
window.location.href = "";
<a href="#" onclick="navigateToURL();">Click here to Navigate RoseIndia home page</a>

Output will be displayed as:

When you click the link, the specified url will get open:

Download Source Code:





Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: JavaScript Navigate to URL  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image