Re: 2 questions: Search in array and detect JS

From: Date: Sat, 15 Apr 2006 19:34:39 +0000
Subject: Re: 2 questions: Search in array and detect JS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-234051@lists.php.net to get a copy of this message
On 4/14/06, Ryan A <Ryan@ezee.se> wrote: > The reason I ask is before serving an AJAX page I would like to make sure JS > is enabled, if not, serve the other "normal page"... I am sure I am not the > first person to come accross this little problem, how did you solve it? Dan eluded to a big problem here, regarding the potential "exit trap" of redirecting a user to a different page. However there's even more at stake--this solution would require you to manage *two* versions of your page. Come on, we can do better than that... What you should do is create your "normal page" as is, and then write your javascript to "attach" itself to whatever things you want to AJAXify on that page. Research "unobtrusive javascript", it should get you in the right direction. The idea is, you build your page to function normally without any javascript. Then you attempt to hook up the javascript via your page's onload event (there are other methods too I believe, Google it). If javascript is enabled, then the javascript will be hooked in; if not, then no AJAX will be loaded, but your page will still function as needed. HTH, John W

« previous php.general (#234051) next »