Javascript to disable right cilck on web site

Just come across with my company SQA team where they request us to do the disable right click features on our front end web site. The initial javascript which exists in our script only work with Microsoft Internet Explorer but not Firefox.

So Google around and found the following javascript which working for both the browser (Firefox and Internet Explorer are the major browser use by our visitor)

Just include this script in our top of the page which you wish to disable the right click function.

<script type="text/javascript">

function md(e)
  try { if (event.button==2||event.button==3) return false; }
  catch (e) { if (e.which == 3) return false; }
document.oncontextmenu = function() { return false; }
document.ondragstart   = function() { return false; }
document.onmousedown   = md;


Leave a Reply, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: