2

I want to prevent the viewing of a CSS file from the browser. Meaning that i want to hide the css from prying eyes. I used this for example:

<Files somefile.css"> 
Require valid-user 
</Files>

But when i use this particular bit for example, the website breaks. Essentially what i want to do is to:

  1. prevent the viewing of a specific css file from the browser.
  2. whilst hiding this on the browser side, allow the website to function as normal.

Is this possible?

Thanks in advanced.

1 Answer 1

2

This shouldn't be possible as the browser must receive the css file in order to render the site properly. And if the browser can read it, so can the user.

Maybe consider either some minification or obfuscation to disguise the code a little bit, or require a user to authenticate before viewing the site.

Sign up to request clarification or add additional context in comments.

2 Comments

It should be noted that even if the code is minified and uglified to one line the browser will still be able to inspect each element and the css applied to it.
Good point, bottom line is you can't really hide css from someone who wants to see it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.