Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Hello,

I would like to disable the developer tool of browser so that no one can debug the web site using the developer tools. How can I achieve this programmatically.

Thanks

What I have tried:

I have tried to disable the keys used to open the developer tools but this is not the robust solution.
Posted
Updated 29-May-20 17:21pm
Comments
F-ES Sitecore 5-Feb-16 7:13am    
As said, you can't do this. If your aim is to "protect" your site somehow then have a read through these.
Philippe Mori 5-Feb-16 13:30pm    
Those tools are intended to be available to the end user.

Even if it was possible to disable tools on one browser, user could use another browser or create its own browser. Thus, the protection is very limited. If someone is able to use those developper tools then he is probably also able to bypass your security.

Even if you would have code to disable it, someone could debug the code that would disable it before that code is run.

You have to understand how the web works. If this is not what you want, then you can create applications instead of using the browser.
Sergey Alexandrovich Kryukov 5-Feb-16 14:43pm    
Why?
—SA
BillWoodruff 5-Feb-16 18:50pm    
Then, you will need to write your own browser that can only be accessed by your own clients on your own network.

You can't disable the developer tools on a browser.
 
Share this answer
 
Quote:
I would like to disable the developer tool of browser so that no one can debug the web site using the developer tools.
This is not possible. You can always lock a key but the user can also define another key to call the dev tools.
You should rather explain what you want to hide from the user, there may be a solution.

By design, the dev tools are made to be always available.
 
Share this answer
 
v2
Chris is right, your website can't disable browser functions. Depending on your environment, there could be an other option:

1. When you have a public web site that I could open on my tablet/notebook/phone, don't block any browser functions. Even if you could (some hacks are possible), just don't do it. Or I will not visit your page again.

2. When you have some kind of web based application running on devices under your control (Something like an ATM?), you can block dev tools, etc. in the browser.

Let me know, if you have case 2.
 
Share this answer
 
v2
Hello, Actually you cant hide source code or block dev toolbox to open but, luckily there is another solution for this. I can just give you can hint because i am also searching for it. The answer is just detect if any one open dev tool, if dev tool is open the redirect it to home page or any where, now the point is how to hide source code that is the tricky part. you can encrypt your source code or use js more and remove white spaces and make it hard to read.
 
Share this answer
 
Comments
Dave Kreskowiak 29-May-20 23:44pm    
First, this is 4 years old so I doubt the OP is still looking for a solution.

On top of that, your solution won't work in the case where you just disable javascript or use another tool to just download the page source without executing the scripts in it.

You simply have no option for preventing people from seeing the page source.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900