How to disable (View Source) and (Ctrl + C ) from my site

This isn’t possible. You could try to somehow obfuscate the code, but you need to send something to client, don’t you? You could use AJAX calls to load your html. This way, the source that the browser will show could be almost empty. However, there is nothing you can do to prevent an experienced user from viewing everything you are sending to the client. In fact there are so many tools he/she can use to reconstruct the page that any technique you will fight hard to apply, will only delay him/her for a couple of minutes.

Regarding the Ctrl-C you could add javascript to block it, but it is useless, since the user can always disable javascript. In fact many users will find interception of right-click very annoying.

All these could have a meaning if you are building an intranet application or you can ship an integrated browser for users to view the application. With public html, I believe it isn’t even worth trying. One solution would be to build your application with flash or another plug-in. This way you can encrypt everything you’ve sent to the client.

Leave a Comment