Friday, December 2, 2016

How to Redirect without notification in HTML

In HTML is there a way to redirect to a different web page without there being a notification? I really need this for a website so that people cannot access work in progress pages and are redirected to the home page. But everything I have tried is an optional redirection.

or if you want to use JS

<script type="text/javascript">     window.onload = function () { location.href = "/root/home.html"; }  </script>
<html>  <head>  </head>  <body>    <script>  window.setTimeout(function() {window.location.assign("http://www.google.com")},3000);  </script>    </body>  </html>
You can use this code. What it does is when you put this Javascript to your html page it will wait 3000 miliseconds and then it automatically redirects to google.com. SetTimeout function is used to wait the specified number of milliseconds, and then execute the specified function.That's what I have done in the above code. window.location.assign("your location name here") is the function which will redirect you to the specified page. You can use this function directly too if you do not want to wait for specific time.

No comments:

Post a Comment

Best Tricks and Tweaks of Adsense