How to disable View source and inspect element

How do you disable/ view source/ and /inspect element/, ctrl + u ctrl+shift+I f12 menu bar and right click, also ctrl + s ctrl p ctrl+v ctrl+a ctrl+c and drag select page, please answer all parts that’s possible, I prefer to do this will JavaScript array keycodes or html no php or other languages.also I want to block ifram use on my site like somesites such as google.
As I understand it is not possible to completely disable view source and inspect element, so I want minification of code and rest of my question answered instead.


I solved alot of it myself, I used onkeydown return false to disable all keys, still need the arrays, I disabled inspect element menu bar by forcing browser to I still need right click, however would like to add that I need a custom right click menu, I disabled the possibility to disable Javascript in order to stop the key block by using noscript function redirects. I also still need the drag and select part. I would still like betterways to fix it…maybe even just minify the code or encrypt it. Of anyone needs some of the code I used just reply. I just need to fix it.

18 thoughts on “How to disable View source and inspect element”

  1. It is not possible to prevent the user from inspecting code running on their machine. At the end of the day the HTMl they are getting delivered will be readable in plain text. You can cause a nuisance for most people, but this will not be a valid security measure – chrome extensions will still run, for instance, so if someone is using the NoScript extension it will disable all javascript.

    A much better option would be to handle your logic serverside, and only send the client the information they need to know/requested.

    There are some free javascript obfuscators, such as Please remember that it is not a secure method, though.


Leave a Comment