Javascript is not reliable for important site functionality. Whatever you do in javascript, you need to program in other methods because javascript is not used by a fairly high amount of visitors, and it is used even less when you start talking about mobile devices and other non-traditional internet devices. It's OK in most instances to make a round-trip to the server for what you need in today's world. Javascript became popular back in the days before broadband when everyone only had dial-up and each page load took 8-12 seconds.
Ken Krauss http://www.kcwebdev.com --- In [email protected], <[EMAIL PROTECTED]> wrote: > > ----- 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/ >
