[ic] HOW-TO on detecting javascript

Kevin Walsh kevin at cursor.biz
Sun Oct 16 11:42:56 EDT 2005


Randy Just [randyjust at justcomp.com] wrote:
> After looking at the various archives for a long period of time and
> also analyzing
> a recent response on this group, I am still befuddled as to good way
> of detecting
> if javascript is turned on or not.
> 
> I have set-up a kludge for users not having javascript enabled to go
> to a non-javascript
> checkout page from shipmode.html.  Right now I have a button in place for
> users to click on who don't have javascript enabled.
> 
> Ideally, I would like to put in the code an [if] statement where if
> an old browser is detected
> or if javascript isn't available, the next button will automatically
> send the user to
> a non-javascript checkout page.
> 
> I am not literate with javascript and have looked at a number of
> scripts from the archive as
> well as testing code sets.  I don't seem to be able to set a variable
> I can compare against
> to go to the javascript enabled or javascript disabled paged.
> 
> I am looking to do something such as
> 
> [if old_browser or no javascript]
>    checkout
> [else]
>    finalize
> [/else]
> [/if]
> 
> with the focus being how to get a javascript value in play to compare
> against. 
> 
I imagine that you could add something like this to your various
"add to basket" forms:

    <noscript><input type="hidden" name="no_javascript" value="1"></noscript>

Once you get to the checkout, you should be able to perform a JS test
like this:

    [if value no_javascript]
        No JS available
    [else]
        User has JS
    [/if]

In theory. :-)

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/



More information about the interchange-users mailing list