0

If one have done some hard work and do not want anyone else to copy it, for example javascript, css, html. Is there a way?

I heard javascript can be obfuscated ( reffering to How can I obfuscate (protect) JavaScript? ) .

Theres no point in doing that for just html as SEO (search engine optimization ) would be effected.

How to do that for .css files though? Its very important for me.

What are the ways to make it harder? (other than just renaming variables/styles to bogus ones) is there a way to include all the css and html into a javascript and then obfuscate the javascript? Thank You.

Community
  • 1
  • 1
kevin
  • 328
  • 4
  • 15
  • 33
  • 1
    Possible duplicate of [tools for obfuscating html and css](http://stackoverflow.com/questions/7278863/tools-for-obfuscating-html-and-css) – Mifeet May 28 '16 at 14:19

3 Answers3

6

The browser's built-in CSS debugger will show the RENDERED CSS, regardless of what sort of obfuscation madness you want to apply.

No point in doing it at all.

Or as I say: If you don't want it stolen, don't put it online.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
  • see answer by kba then please. may be there would be some additional ways. – kevin Mar 04 '13 at 22:02
  • is there a way to include all the css and html into a javascript and then obfuscate the javascript? – kevin Mar 09 '13 at 04:03
  • @Masood It's irrelevant - anyone with any appreciable experience can reverse-engineer a usable CSS from what the browser reports in even the most basic developer tools. – Tieson T. Mar 09 '13 at 04:16
  • @TiesonT. its only about making it harder. i know its reversable in any case – kevin Mar 09 '13 at 04:26
  • I believe his point is that while you make it 'harder' there are evolving tools that keeping it 'easier'. Why spit into the wind? – Michael M Apr 16 '13 at 05:22
2

You can parse/regex your outbound html with your external css files to make all your html have inline css, so nobody knows what classes you use.

Edit, yes, this is horribly and ridiculously inefficient, but it does prevent people from copy/pasting your valuable css files.

Brad M
  • 7,857
  • 1
  • 23
  • 40
  • sorry i didnt got that? "outbound html with your css" "inline css" – kevin Mar 04 '13 at 22:04
  • 1
    He's saying that you can make a script that replaces all `id` and `class` attributes in your HTML with the actual style, thus making it less readable. I still don't think this is worth it. It's easily countered it'll make your HTML source code bigger. – kba Mar 04 '13 at 22:05
  • 1
    You can, but there goes all ability for the browser to cache your CSS. Your page size would become huge and slow, because the entire page would have to be re-parsed and re-rendered every time the browser resizes. – Diodeus - James MacFarlane Mar 04 '13 at 22:05
  • is there a way to include all the css and html into a javascript and then obfuscate the javascript? – kevin Mar 09 '13 at 04:02
0

JavaScript can be obfuscated by using nonsensical variable and functions names and removing all formatting.

In CSS, the only thing you have control over is id names, class names and formatting. These are things that can easily be ignored or fixed, so there many other ways to obfuscate.

kba
  • 19,333
  • 5
  • 62
  • 89
  • nice, can you elaborate further? or think of more ways? – kevin Mar 04 '13 at 22:01
  • Which part? As I said, you can give your elements bad class and id names, but that won't really matter much at all. Other than that, you can one-line it all to make it less readable, but this can also be undone quite easily. So no, CSS obfuscation is futile. – kba Mar 04 '13 at 22:03
  • is there a way to include all the css and html into a javascript and then obfuscate the javascript? – kevin Mar 09 '13 at 04:04
  • 1
    The generated CSS will still be viewable. But seriously, your CSS can't be that amazing - it's just a damn stylesheet, no actual programming or algorithms are involved. Most decent designers will be able to rebuild whatever you're trying to hide very quickly, even without your CSS. – kba Mar 09 '13 at 15:32