Style sheet (CSS ) protection from public
We need to protect my external style sheet downloading from others
eg: if click the save as button from a brows开发者_JAVA技巧er that will get all images, html and style sheet of the website. we need to block downloading my website images, html and CSS
how is it possible
please help me .......
That is technically impossible and illogical. Your HTML, CSS and images need to be available to everyone that can access the site, otherwise they wouldn't be able to view them in the first place. And by definition, you have no control over the client's browser which handles the downloading and saving of said resources.
By the way, there are some tricks employed by people wanting to do the same (like using Javascript to block the right click menu) but such tricks are just that: Tricks. They trick the naive user into thinking that some resources can't be downloaded/saved. However such tricks are easily circumvented by a user with very little knowledge.
HTML, Javascript and CSS code are by definition provided to the user as source code.
This is not like a compiled desktop application where the user cannot see the code behind the scenes -- all web pages are provided as source code. There is nothing you can do about this.
It is possible to make it hard to read by minifying it, although this trick works better with Javascript than it does with CSS. But the primary goal of minifying is not to make it unreadable, but to make it smaller for download; the fact that it becomes hard to read to read is more of a side-effect.
If you really are paranoid about people stealing your hard work, then bluntly, HTML+JS+CSS is the wrong platform for you. You might be able to hide your code more effectively with Flash or Silverlight, though to be honest, even in these, it is possible for a relatively skilled hacker to unpick them and get at the code.
But the fact is that HTML and CSS code are never going to be valuable assets. They are far too simple to produce anything radically unusual; everything in your HTML and CSS code will already exist in countless other sites, so your code isn't going to be worth stealing, and even if it is, it isn't worth protecting.
The same applies even Javascript code. If there might be some justification in wanting to protect Javascript if you've written something spectacularly complex and unusual, but for the majority of sites, even the JS code isn't going to be complex enough to be worth protecting.
How should any user be able to view the content you provide without prior downloading it?
Its not possible... :(
The best you can do is minimize it and maybe there is a css obfuscator out there.
Browsers must be able to understand the CSS in order to render the page. So, it is not possible to protect the CSS from downloading, because if you want the page to work, the browser must download it.
精彩评论