This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes detect if javascript is enabled/disabled Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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: 35247
    
    7
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


Android appsImageJ pluginsJava web charts
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12268
    
    1
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: detect if javascript is enabled/disabled
 
Similar Threads
Java Enable detection??
about scripting information in browser
Associating button with text field
To check for javascript
Post date is not shown