Prev Demo
JavaScript
>
Redirecting User
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Redirecting to other page</h1> <script> function TestFunction() { alert(location.href); location.href = "http://www.itfunda.com"; } </script> <input type="button" id="btnTest" onclick="TestFunction()" value="Click me" /> <p><strong>Note:</strong> Click the button to get the alert, in the alert click 'OK' button to redirect to the other page.</p> </body> </html>
Note: We DO NOT save your trial code in our database.
Output