RE: [PHP] Detecting JavaScript

From: Date: Mon, 26 Feb 2001 17:06:57 +0000
Subject: RE: [PHP] Detecting JavaScript
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41704@lists.php.net to get a copy of this message
this is a function that is BUILT-IN to HTML for the last few versions. <script> //some script here </script> <noscript> <meta http-equiv=refresh content='5;url=http://some.nonjavascripting.page'> </noscript> -- this will redirect non-javascript browsers to a non-javascript page. DanO -----Original Message----- From: Dave Goodrich [mailto:daveg@rblc.com] Sent: Monday, February 26, 2001 8:56 AM To: jk@wa-p.de Cc: php Subject: Re: [PHP] Detecting JavaScript Nothing tested, just off the top of my head. The single most reliable way to do that would be to have a page that runs JavaScript. For instance, if the JavaScript executes, it redirects to your JavaScript enabled page, if not, the page does a refresh to a non JavaScript enabled page. <html><head><title>tester></title> <script language='JavaScript'> window.location('http://some.javascript.enabled.page'); </script> <meta http-equiv=refresh content='5;url=http://some.nonjavascripting.page'> </head> The trick would be a matter of timing, the JavaScript must successfully execute before the timer runs out on the refresh tag. You can of course get much fancier, changing the redirect based on the client information that PHP has available. PHP could effectively write the JavaScript to the page based on the known capabilities of the client. For instance the refresh tag is generally useless for browsers like Lynx, as is the JavaScript. Alternatively, you could (just supposing now...) have the first page do an instant refresh, using JavaScript to trigger a value in PHP. If the value is set, JavaScript was enabled, if it is not, JavaScript was turned off. But I've not tried it. DAve -- Dave Goodrich Director of Interface Development Reality Based Learning Company 9521 NE Willows Road, Suite 100 Redmond, WA 98052 Toll Free 1-877-869-6603 ext. 237 Fax (425) 558-5655 daveg@rblc.com http://www.rblc.com

« previous php.general (#41704) next »