• 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 can we protect css, js files with out being publicly accessible ?

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I started a small sturts based application and was using a css file. Though tutorial, mentioned to keep the css file at application level, I experimented putting it under WEB-INF, though I was skeptical. As expected, css file is not accessible as browser would not be served those restricted files by the container. But that leaves me a question, on how to protect css or js files which are used by browser, if I can not keep them in WEB-INF. Keeping the point of protecting those resources aside, but how to do that, if we have to ? Can some body explain me this ?

Thanks
 
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
You can't. If the browser can get at the files -- and it must, that's how HTTP/HTML works -- then anyone can. If you hide them, then the browser no longer has access either.

I can almost understand wanting to hide the JavaScript (maybe), but who cares about the CSS?

If you are really concerned about the script, you can pack or minimize it which adds a level of obfuscation.
 
Rajani Gummadi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear,

I do agree that protecting css is not adding any value, as hardly any body would care. But coming to javascript, what do you mean by packing and how do we do that ?
 
Bear Bibeault
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
javascript packing

Dean Edward's packer
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic