• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to detect javascript from jsp

 
Salman Bashir
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

How can i get to know about the Javascript i.e., whether it is enabled or disabled at server side. Also how can i get the javascript version from jsp.

I can not use values stored (e.g., hidden form fields) by javascript in the jsp page. Just need to know the version and js enabled/disabled information from the server side right after getting the hit from the client.

Thanks for your help,

Regards

Salman Bashir
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You won't know on the first hit but if your page has a form, you can test when that form is submitted.

In your form, add one hidden field.
Then from the form's onsumbit or the body's onload event, change the value of that field.



From your servlet/jsp, read that parameter with request.getParameter.
If it's "true" then you know that javascript was enabled when the form was submitted.

I don't know how to get the version.
The User-Agent header will tell you what make and version browser the user has (or which one they're claiming to have anyway).
[ August 12, 2005: Message edited by: Ben Souther ]
 
Salman Bashir
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben Souther

I already am using this mechanism, but i want to know a mechanism by not setting any value from javascript.

I mean is there any way to getting the javascript version + enabled/disabled information from the server side, i.e., may be by using an HTTPServletRequest class or some other class providing this mechanism.

Thats what i meant initially.

Thanks for your response, and still waiting for suggession regarding this problem.

Regards,

Salman Bashir
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing JSP-specific about this, so moved to the HTML forum.
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure if this is possible. I don't believe the HTTP headers contain any information such as if the browser has enabled/disabled JavaScript, just like I don't believe it will contain information if the browser will allow PopUp windows.

I think your best suggestion is to store this information in a hidden field and access this information thru the HttpServletRequest object.

But, I could be wrong, I am not an expert. I, also would be interested in a solution.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic