File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "detect if javascript is enabled/disabled" Watch "detect if javascript is enabled/disabled" New topic
Author

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
Marshal

Joined: Mar 22, 2005
Posts: 41489
    
  53
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
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
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