How to go to another page using JavaScript

I am currently redirecting users to another page in C # with the following code;

Response.Redirect("somepage.aspx"); 

However, I would like to do this in JavaScript.

+6
source share
2 answers

Try this code below

 <script language="JavaScript"> <!-- function move() { window.location = 'http://www.yourdomain.com' } //--> </script> 
+22
source

Basically you need to:

 function goURL() { location.href="http://example.com" // change url to your's } 

Additional java-script navigation options can be found at the following link: http://www.sivamdesign.com/scripts/navigate.html

+8
source

Source: https://habr.com/ru/post/906650/


All Articles