Solved

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

Posted on 2009-05-07
2
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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 …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

615 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