Simple ways to Disable Context Menu in Browser

How to disable context menu and hence disable Browser Back button?

In programmers life, there comes a situation where he/she had to disable the browser back button functionality or the back button feature on the context menu (the menu that appears when users right click on the browser content).

A simple way to disable Context Menu in browsers will be to use javascript as follows …

<html>
<head><title>How to disable content menu Back button?</title></head>
<body onContextMenu="javascript: return false;" >
<h1>Sample Text</h1>
<span style="font-size: 1.5em;">Check the CSS of this styling in the source file</span>
</body>
</html>

CSS related hint: I have used font size of 1.5em to emphasize on how “em” (the “M” space) can be used to increase the font size of the texts relatively.

Share

Written by kurinchilamp


Website: http://

Leave a Reply

Your email address will not be published. Required fields are marked *