Forum Moderators: not2easy

Message Too Old, No Replies

Protecting a css file

just wondering if a css file can be protected

         

Smad

3:30 pm on Nov 26, 2003 (gmt 0)

10+ Year Member



I was wondering if anyone knew a way to use css to present a page but not allow the css file to be cached or displayed/saved etc.

TIA

DrDoc

3:39 pm on Nov 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not cached, as in "don't save a local copy"?
If that's the case, it can't be done. If you want to protect it from being downloaded, then I suggest deleting your CSS file entirely.

However, if you're merely talking about "next time you come to this page, don't use your cached copy, request a new one"... That can be done (though I don't know why you would want to do that since it would defeat one of the great purposes behind CSS).

chadmg

4:06 pm on Nov 26, 2003 (gmt 0)

10+ Year Member



I once considered adding some server-side code to my css and js files that would check if the referer was from my server, and if it wasn't then show nothing. So the browser would still cache a copy when it viewed my page. But if someone opened up the source and then tried to download the file directly it would return an empty file.

But I then realized this was waste of my time. If someone wants to learn from my code than more power to them. If someone wants to steal my code then I'll just damn them to hell. :)

DrDoc

4:28 pm on Nov 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Plus, what if they have the referer turned off for privacy reasons?

Smad

4:43 pm on Nov 26, 2003 (gmt 0)

10+ Year Member



Basically I was trying to protect the way I had designed a site (css) from being taken and then used by a 3rd party.

chadmg

5:00 pm on Nov 26, 2003 (gmt 0)

10+ Year Member



DrDoc, then their paranoid behinds can view the page unstyled ;)