Solved

how to use redirect funtion of php if javascript is disabled.

Posted on 2009-05-07
2
212 Views
Last Modified: 2012-06-21
Hello, i want to redirect page if javascript is turn off but i am not getting idea .how ? i did this but not working...
<noscript>
<?php
redirect('jsdisabled.php');
?>
</noscript
<body>
<noscript>
<?php
redirect('jsdisabled.php');
?>
</noscript>
</body>

Open in new window

0
Comment
Question by:san4u49
2 Comments
 
LVL 1

Accepted Solution

by:
Patrick_NG earned 20 total points
ID: 24323405
Quite a common problem, one which can't be solved by PHP, as the redirect command works by modifying the header - and you can't modify the header any more after you wrote a single line of HTML output (such as <body> and <noscript> in your example).

You need to be a little tricky for automatic redirects - the issue and a workaround is very well described over at http://www.rocket99.com/jscript/jsdetect.html. The core part of it is attached to this post.
<HTML> 
<HEAD> 
  <SCRIPT LANGUAGE="JavaScript"> 
  <!-- 
      window.location = "jsenabled.php" 
  //-->
  </SCRIPT> 
  <META HTTP-EQUIV="REFRESH" CONTENT="1; URL=/jsdisabled.php"> 
</HEAD>
 
<BODY> 
   <A HREF=/jsdisabled.php><IMG SRC=images/giantcoLogo.gif HEIGHT=60 WIDTH=120 BORDER=0 ALT="GiantCo Home Page"></A> 
</BODY> 
</HTML> 

Open in new window

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question