How to disable console in web? Is there any code for this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to disable console in web? Is there any code for this?

Consol log is disturbing little bit during practice.

21st May 2020, 3:36 AM
Utkarsh Meshram
Utkarsh Meshram - avatar
3 Answers
+ 2
This must be your very first script in head tag: console.log = function(){ }; To help you understand Tarun Pandey's answer i'm giving you the original article: https://www.queness.com/post/16151/disable-javascript-console-in-browsers It's ugly , old and doesn't work for all environments. I can't recommend that.
21st May 2020, 5:16 AM
Kevin ★
+ 1
To disable Javascript console, we need to throw an exception in the get accessor by checking if the property attached by chrome developer tool exists. With this script above, user won't be allowed to enter Javascript in the console. It also blocks auto-complete in console too.
21st May 2020, 4:13 AM
Tarun Kumar
Tarun Kumar - avatar
+ 1
Thank you friends! I appreciate your help!
21st May 2020, 4:00 PM
Utkarsh Meshram
Utkarsh Meshram - avatar