Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

detect if javascript is enabled/disabled

 
Antonio Giovanni
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William ,

Thanks a lot,.. That is working cool..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic