Forum Moderators: open

Message Too Old, No Replies

How to redirect inside HTML

Do not use javascript and meta refresh

         

iProgram

2:42 pm on Aug 15, 2005 (gmt 0)

10+ Year Member



One of my web page requires javascript and I want to redirect visitors who do not have javascript to another page called no-js.html:
<html>
<head>
<title>Test Page</title>
</head>
<body>
<noscript>
How to redirect to /no-js.html here?
</noscript>
</body>
</html>

The <meta http-equiv="refresh" content="0;url=/no-js.html" /> is not allowed in <body> tag. The <noscript> tag is not allowed in <head> tag...

birdbrain

3:56 pm on Aug 15, 2005 (gmt 0)



Hi there iProgram,

How to redirect inside HTML

Just use the anchor element like this....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224">
<html>
<head>
<title>Test Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
<!--
alert('javascript is enabled');
//-->
</script>
</head>
<body>
<noscript>
you have javascript disabled please go to...
<a href="no-js.html">no-js.html</a>
</noscript>
</body>
</html>

birdbrain

iProgram

3:09 am on Aug 16, 2005 (gmt 0)

10+ Year Member



Seems this's the only method I can use. (I don't want the users who have js disabled to see my original page at all.)

tedster

3:15 am on Aug 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe approach it from the other angle - make the non-javascript page the DEFAULT page, and then use javascript to redirect people who have js enabled.

iProgram

3:56 am on Aug 16, 2005 (gmt 0)

10+ Year Member



Maybe approach it from the other angle - make the non-javascript page the DEFAULT page, and then use javascript to redirect people who have js enabled.

This is the method that Gmail is using. I will try this method. A problem is, I have to update all links on my site to their non-js pages. Or I change all links to no-js.html and use javascript to to redirect like this:

<a href="/no-js.html" onmouseup="goto_page('home');">Home</a>

<a href="/no-js.html" onmouseup="goto_page('contact');">Contact Us</a>