sean commented on a Page, Hide your CSS Source  -  Dec 08, 2010

To avoid Hawkee's condition, you could use an adaptive stylesheet filename possibly derived from the a piece of client information to provide some lair of dynamics.

To simplify this process, you could always have a "real" stylesheet which this snippet would make a replica. This way, not only do you limit the unneeded overhead of SQL queries but, you can edit your CSS "naturally" without needing to escape it prior to inserting it into your database. Alternatively, You could also rig up a session based stylesheet that would prevent the user from regaining access once the page has been displayed.

The biggest flaw to this type of hiding, is that most browsers (especially Firefox) typically render a cache'd version of CSS or JS when called upon by viewing source. This means once the user has essentially downloaded a copy by visiting your site, they would still be able to see the source. Unfortunately, that pretty much leaves this snippet useless.

Overall, I agree with Hawkee, "CSS is meant to be public and should stay that way.".

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.