wood burning stoves 2.0*
The moose likes Servlets and the fly likes detect if javascript is enabled/disabled Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "detect if javascript is enabled/disabled" Watch "detect if javascript is enabled/disabled" New topic

detect if javascript is enabled/disabled

Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85
Hi all,

Is there a way on the java server side to detect, if the javascript is enabled or disabled on the client m/c..

It would be great if somebody can give an example code..
i appreciate your help
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41155
A rough outline would go like this:
1) Open a session on the first page you serve
2) in that page, include JavaScript code that will hit a particular URL. This needs to happen w/o the user doing anything, e.g. disguise it as an image URL.
3) in that URL, include a parameter that uniquely identifies the session from which the page was served
4) once that URL is requested, make a note in the session that JS is enabled

Ping & DNS - my free Android networking tools app
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
If your entry page has a form, use a hidden variable in the form and have an onload javascript write a different value into the variable.
Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85
Hi William ,

Thanks a lot,.. That is working cool..
I agree. Here's the link: http://aspose.com/file-tools
subject: detect if javascript is enabled/disabled
Similar Threads
Post date is not shown
about scripting information in browser
To check for javascript
Java Enable detection??
Associating button with text field