<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>test</title> </head> <body> <script> document.oncontextmenu = function (event) { event = event || window.event; event.preventDefault ? event.preventDefault() : event.returnValue = false; alert(event.type); }; </script> </body> </html>