Friday, October 28, 2022

[SOLVED] Konkqueror and KHTML engine - disable right click

Issue

I'm using Konqueror 4.14.25 with KHTML engine and cannot disable the right click (the context menu). I've tried

document.addEventListener('contextmenu', function(event) { event.preventDefault() });

but it seems that the contextmenu event does not exist. Using webkit engine i am able to disable the right click! Due to the project tasks I am forced to use Konqueror browser with KHTML engine. Any idea how can I disable the right click?


Solution

After many unsuccessful combinations and tries I finally found one that should work:

        document.oncontextmenu = function() {
           return false;
        }

Also

<body oncontextmenu="return false;">

won't works. The reason is unknown. khtml does not recognize it.



Answered By - lazerbrain
Answer Checked By - Willingham (WPSolving Volunteer)