-2

Is there anyway to hide css code from source code. So, no anyone can copy my code. Or, any other language is available for styling like css and it is not visible in source code. I know it's silly question.

Here I am also asking about alternate language of css which is not visible in source code.

Jhon
  • 29
  • 8
  • How to protect css files is unclear question. And my question is different. Here I am asking about language also for styling like css which is not visible in source code. – Jhon Oct 28 '18 at 05:34
  • Yes it's probably a silly question. But why do you want to do this?? – Rotimi Oct 28 '18 at 05:35
  • I want to hide my source code from user. – Jhon Oct 28 '18 at 05:37
  • You say you hide your JavaScript, how do you manage with that? I believe you are the first person in the world who managed so please share. – Andreas Oct 28 '18 at 06:18
  • @Andreas most likely OP wraps Javascript in `` tags. E.g if user is logged in, then display javascript to make ajax request. Of course this file would be `.php`. Bad practice (Spaghetti code), but i've seen some code snippets following such patterns with the belief of obscurity – Rotimi Oct 28 '18 at 07:05
  • Thanks everyone to help me and clear my doubt. Specially, you @Akintunde-Rotimi to clear my doubt on wrapping java-script code into php. – Jhon Oct 28 '18 at 10:27

2 Answers2

2

Is there anyway to hide css code from source code. So, no anyone can copy my code.

Short answer: No. CSS must be sent as plain text to your clients' computers if you want your page to be rendered.

I hide my Javascript code from source code by implementing between PHP.

What? No, you cannot hide Javascript either, for the same reason.

You can minify or obfuscate this code, but you cannot avoid sending it (if you want it to be used).

Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328
-2

There is NO way to hide the client side components like CSS.

you can check it here

Abhishek Mani
  • 502
  • 4
  • 12
  • 2
    If you find that a question already has an answer on SO, please flag the question as a duplicate (use the `flag` link under the tags) instead of posting a link to the duplicate as an answer. Because this question is a duplicate it will eventually get deleted and you will lose any reputation gain from the answer anyway. – Nick Oct 28 '18 at 06:05
  • got that! @Nick – Abhishek Mani Oct 29 '18 at 00:57