----- Original Message -----
From: "Phill Sparks"
On 15/06/07, Gordon Stewart <[EMAIL PROTECTED]> wrote:
>
> Is there any PHP (or Javascript code ) that can detect if Javascript
> is turned on - & then if its off - Do something ?
>
The only way I know to do this is by getting javascript to "ping" the
server (simple XMLRequest) and then store the response in the _SESSION
ready to be inspected later. The only problem with this is that there
will be add a 1 page lag to your script's knowledge about the
prescence of JavaScript.
Phill
-------------------------
There are alternatives to AJAX like scripting.
For a single page you can use javascript to append a GET method to URL(s) or
you can prepend to all relative urls on the home page to a subdirectory -
<script language="javascript" version="2">
// use the above to select the minium version required - may be ver and not
version ???
$links = getElementsByTagName("a");
for($index = 1; $links[$index]; $index++)
{
$one_link = $links[$index];
$href = $one_link.href;
$href = "js/" + $href; // diferent directory
$href = $href + "?javascript=enabled"; // for GET method
$one_link.href = $href;
}
You can use something like $href = $one_link.properties("href") OR $href =
$one_link.attributes("href")
I am NOT sure - My javascript is not good.
To retrieve the value in php -
if ($GET["javascript" == "enabled")
{
// do java stuff
}
else
{
// do non java stuff
}
OR simply have the javascript enabled pages in mydomain.com/js/