-2

 I just want to disallow the user to open CSS & JavaScript's Link through .htaccess(i.e. http://www.example.com/desgin/MainPage.css is not allow to open as url). So Please tell me something through which i can just protect my Coding from others.The page is built in PHP, HTML, CSS, JAvascript, Jquery. So you can give solution in these languages.
  Thank You

gopal sharma
  • 129
  • 1
  • 6
  • If your website is coded in PHP, the others cannot copy your source because it is rendered on the serverside (PHP = Server-Side Language), they can only copy the plain HTML which is no big deal because their is no logic included. – Noshii Jun 06 '16 at 12:38
  • The solution is to sue for copyright violation. But since that is not in general realistic you just have to accept it. You can obfuscate but there is no real protection there and it will make your development more difficult. – zaph Jun 06 '16 at 13:28

2 Answers2

0

This is definitely not possible to do from a web page.

Even if you disable right click and disable the default behaviors for F12, Ctrl+Shift+I, and Ctrl+Shift+J, there is no way to stop a user from opening Dev Tools on a different page and navigating to your page with Dev Tools already open.

Also, you can access Dev Tools by going to Menu > Tools > Developer tools, which cannot be prevented by any website. following code to prevent the right-click & F12

 window.oncontextmenu = function () { return false; }
document.onkeydown = function (e) { 
if (window.event.keyCode == 123 || e.button==2) return false; 
}
Anurag Deokar
  • 840
  • 7
  • 13
0

As Anurag Deokar already stated you cannot hide either javascript or css code, i suggest you consider obfuscating your code. There are several tools through the web you just have to fiddle around with them to see what works best for you. You can reference this topic.

But keep in mind that:

The only way to truly keep something secret is to not send it to the client. If they don't have it, they can't read it. Sending it encrypted is just asking for trouble at the hands of the few people who actually care, and everyone else won't poke around even if you send it in the clear (c.f. DRM).

Community
  • 1
  • 1