Solved

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

Posted on 2009-05-07
2
204 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now