Disable Inspect Element/Source Viewing by mouse click in a website

What if you want to disable source viewing in your site? Disable the right click method? Read on to find out how. Having inspect element in Google chrome hastens debugging process of website. We will just hover over an element and wallah! We can get the css or the technique on how that element was designed. You can also delete that element on that page. Take for instance, removing those annoying popups or changing the opacity of modal boxes. It has its benefits for debugging. But what if, we want it the other way around. What if we want to make it harder for our knowledgeable users to just delete the element. Well, it's pretty simple. The code below will disable inspect element in your website.


$(document).bind("contextmenu",function(e) { e.preventDefault(); });

Comments