1

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.

5
  • 1
    This should be a server-side operation and not a client-side one. Which programming language is your site's back end running on? Commented Nov 8, 2013 at 16:50
  • doesn't matter what language, you can do it with your meta data on the html side Commented Nov 8, 2013 at 16:51
  • 2
    @DWolf A few modern browsers will notify you that this is happening and ask if you're sure you want to be redirected. I believe that's what the question is about. Commented Nov 8, 2013 at 16:52
  • Note you can't be sure that people won't access your pages if you use client-side programming. That's because client-side programming runs on client's machine, so client has full control over it. Commented Nov 8, 2013 at 16:55
  • @matewka that link states nothing about not the user not being notified. Commented Nov 8, 2013 at 16:56

3 Answers 3

0
<meta http-equiv="refresh" content="0; url=http://yoururl.com/" />

or if you want to use JS

<script type="text/javascript">
   window.onload = function () { location.href = "/root/home.html"; }
</script>

also works.. just tested it on my server...

Sign up to request clarification or add additional context in comments.

Comments

0
<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.

Comments

0

You haven't specified what (if any) server-side technologies you're using, but I've got to go for a bit, so I'll leave this here in case it's of any use.

If you're using ASP or ASP.NET, you can use Server.Transfer. This will stop the rendering of the current page, without stopping the current request, and allow you to start the rendering of another page instead. The net effect is that the URL in the browser stays the same, but a different page is sent to the client.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.