[Javascript] Javascript detection
tedd
tedd at sperling.com
Tue Jan 2 11:02:02 CST 2007
At 4:54 PM +0000 1/2/07, Nick Fitzsimons wrote:
>Surely the easiest way is to just use self.location.href to redirect
>to some page; if JS isn't enabled, it won't do anything. So, (with
>prior apologies for any syntactical errors in PHP, which isn't my
>usual server-side technology):
>
><html>
><head>
><?php
>if (session_not_already_in_progress()) {
> print("<script>self.location.href=\"startSession.php\";</script>");
>}
>?>
></head>
><body>
><h1>Hello world</h1>
></body>
></html>
>
>where startSession.php does whatever it does (including setting
>whatever it needs to detect that the session has already begun in
>the function "session_not_already_in_progress"), and then just
>redirects back to the above; as the session has been started, the
>redirection script won't be created by the server on the second time
>around, but the server knows that JS must be enabled for
>"startSession.php" to have been requested. On JS-disabled clients,
>"startSession.php" will never be requested.
>
>HTH,
>
>Nick.
Nick:
Your technique is simple and I am sure it works. It's similar to this:
http://sperling.com/js_detect1
Sometimes it helps to bounce stuff off other people's heads. :-)
Thanks.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
More information about the Javascript
mailing list