• 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 know cookies and script disabled

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well What technique we should apply to know that cookies are disabled in browser so we can start url Rewriting.Also how can we know about script disabled.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
*you* don't really have to know if cookies are disabled, as the encodeURL method on the response object will either
a)not rewrite the URL because cookies are enabled
or
b) rewrite the URL because they are disabled (or refused).

So it's at least partly transparent to you.

Not too sure about detecting if scripting is disabled. You can't do it with JSP code, because that's the server side, and it doesn't know anything about the client. And you can't do it client side, because what script will you run to check, if scripting is disabled?

That last bit was me thinking out loud.
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike Curwen:
Not too sure about detecting if scripting is disabled.[...]And you can't do it client side, because what script will you run to check, if scripting is disabled?

That last bit was me thinking out loud.


I havent tried it with code but it should be possible to use a hidden field called jsEnabled and a script document.forms[0].jsEnabled.value="yes" in onLoad event of the body tag. You can check then this field in the servlet. If the field-value is not yes JavaScript is disabled.

Axel

 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which would require at least a single request-response cycle before the server side would know about it. So perhaps on the index page?

To be clear.. the javascript would set the flag if it was able to.. but JSP/Servlets would only know this after that page's form was submitted.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 2 good reasons to have a web app's home page be an HTML page.
First, because it's the easiest thing to serve up. Only a major server failure is going to break it. Plus, a sloppy server config is more likely to look for an "index.html" page than something named, say, "firstpage.jsp" if the user types the URL with no explicit page name.
Secondly, it's a great way to snoop the client's capabilities, including cookies, JavaScript, client-side Java, and what browser they're using (suprise! not EVERYONE's running IE!).
reply
    Bookmark Topic Watch Topic
  • New Topic