• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

url redirect

when a user open the page, it should automatically redirect to another site, how can i do this
0
ammadeyy
Asked:
ammadeyy
1 Solution
 
rbartzCommented:
A nice way to do redirects in an HTML page is put this right below the body tag...

<body>
<script language="JavaScript">
window.location="http://www.theothersite.com/page.html"
</script>
<p>You are being redirected to the right place now, hang on a sec...</p>


The quick and dirty way to do it is to put htis right under the <head> tag:

<head>
<meta http-equiv="refresh" content="0;url=http://www.theothersite.com/page.html" />

Either way will take them the the site in the url.  The 0 in there is a delay in case you want to let them see somehting first, like "You are being redirected to..."  You put that (or anything you want) in the body of the page.

R
0
 
basicinstinctCommented:

I personally think the meta tag is the nice way...  It will work regardless of whether JavaScript is enabled or not.
0
 
GawaiCommented:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.yoursie.com/newpage.htm/">
<title>Welcome</title>
</head>

<body>

</body>

</html>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Nish_since1981Commented:
Hi ,

<script
<html>
<body onload ="document.form.submit();">
<form  action= "url  of the site">
</form>
</body>
</html>
0
 
FSIFMCommented:
All the ways mentioned above are fine, but as we are in the ASP section here is how you redirect using ASP code.

<%
Response.Redirect("http://www.yoursie.com/newpage.htm")
%>
0
 
rbartzCommented:
Sorry FSIFM...

This is web development, but not ASP...

I am curious though, will

<meta http-equiv="refresh" content="0;url=http://www.theothersite.com/page.html" />

work in the header of an ASP page?
0
 
rbartzCommented:
Hello...

Do whatever you want, but please note that basicinstruct and gawai simply agreed with my initial answer, and Nish_since1981 only suggests an alternative javascript method no more effective but more complex than I did.

FSISM wrongly thought that this was the ASP section, and gave an answer that was not generic enough for any but ASP pages.

Thanks.

R
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now