• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to detect javascript from jsp

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing JSP-specific about this, so moved to the HTML forum.
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic