AVeryNiceWeb

[Javascript] URL Redirection

[Javascript] URL Redirection

Postby admin » Sun Oct 08, 2017 2:13 pm

Select what is most suitable to your needs:

// Sets the new location of the current window.
Code: Select all
window.location = "https://www.example.com";


// Sets the new href (URL) for the current window.
Code: Select all
window.location.href = "https://www.example.com";


// Assigns a new URL to the current window.
Code: Select all
window.location.assign("https://www.example.com");


// Replaces the location of the current window with the new one.
Code: Select all
window.location.replace("https://www.example.com");


// Sets the location of the current window itself.
Code: Select all
self.location = "https://www.example.com";


// Sets the location of the topmost window of the current window.
Code: Select all
top.location = "https://www.example.com";


Use it like in this example:

Code: Select all
<SCRIPT LANGUAGE="JavaScript">
// Sets the new location of the current window.
window.location = "http://example.com";
</SCRIPT>


For in-depth explanation and more options, go to:
https://appendto.com/2016/04/javascript ... avascript/
The AVNW Support Team
http://www.AVeryNiceWeb.com

We also have great domain names for your next website. Go through the list and make an offer now!

Shopping for a new website? See our design deals.

How much is your website worth? Get a free estimate.

And, if our post has provided you with great information, there are a few ways you can show your appreciation:
  1. Like us on Facebook
  2. Post a review.- Posting a good review about this site could help us provide improved support.

Thank You!
User avatar
admin
Site Admin
 
Posts: 467
Joined: Sun Jan 12, 2014 11:18 pm
Location: New York City

Return to Support

Who is online

Users browsing this forum: No registered users and 0 guests

cron