Bug 74753 - [WebCore] javascript onContextMenu method is not supported
Summary: [WebCore] javascript onContextMenu method is not supported
Status: RESOLVED UNMAINTAINED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: Mandrake RPMs Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-09 20:50 UTC by Jalpesh Patadia
Modified: 2024-05-06 20:51 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jalpesh Patadia 2004-02-09 20:50:53 UTC
Version:            (using KDE KDE 3.1.4)
Installed from:    Mandrake RPMs
OS:          Linux

The onContextMenu function is not a W3C standard but is very commonly used in webpages to control what appears when a user right clicks on a page. Both IE and Mozilla support this on the <img> and the <a> tag.

It would be great if konqueror can support this functionality too. The right click functionality can be very useful for developers to provide shortcuts to certain actions in a page.

The syntax is very simple. To use it from within the <a> tag, you would type :

<a href="<my url>" onContextMenu="javascript:myFunction()">Click Me</a>

Thanks,
Jalpesh.
Comment 1 Jason Keirstead 2004-09-23 19:15:21 UTC
The event isn't supported at all, not just on IMG and A tags.

Having this event would be very good to have, many web apps use it now and expect it to be cross-platform since IE and Mozilla/Netscape and Opera have it.
Comment 2 Allan Sandfeld 2005-01-08 13:25:17 UTC
It is implemented in WebCore
Comment 3 Allan Sandfeld 2005-01-08 13:39:17 UTC
Btw. Do you have any real-world test cases I can use, if I decide to merge it from WebCore?
Comment 4 Jason Keirstead 2005-01-08 18:29:44 UTC
It is pretty simple to test. Here is one below. Interestingly, Firefox doesn't even pass the first one! Works in IE though:

<html>
<head>
<script>
function contextTest1()
{
    alert('Test 1 works!')
}

function contextTest2()
{
    alert('Test 2 works!');
}

onload = function() {
    document.getElementById('test2').oncontextmenu = contextTest2;
}

</script>
</head>
<body>
<div oncontextmenu="contextTest()" id="test1">Right click me for test 1!</div>
<div id="test2">Right click me for test 2!</div>
</body>
</html>

By the way - if this is merged, I think there should be an option to disable it in the Javascript prefs, just like popups.

While I really need support for this extention for my web application, I totally sympathize with people who get annoyed with websites that use this event for stupid reasons.



Comment 5 Jason Keirstead 2005-01-08 18:30:29 UTC
Oops - the oncontextmenu="" should be contextTest1. Thats why it failed in Firefox. Stupid typo.
Comment 6 Leo Savernik 2005-03-11 18:19:12 UTC
> Oops - the oncontextmenu="" should be contextTest1

So why did it works in IE then? This browser is freaky.
Comment 7 Jason Keirstead 2005-03-11 19:07:11 UTC
It wouldn't work in IE either :P

The syntax was wrong.
Comment 8 Christoph Cullmann 2024-05-06 20:51:17 UTC
Dear user,

KHTML (and KJS) was a long time more or less unmaintained and got removed in KF6.

Please migrate to use a QWebEngine based HTML component.

We will do no further fixes or improvements to the KF5 branches of these components beside important security fixes.

For security issues, please see:

https://kde.org/info/security/

Sorry that we did not fix this issue during the life-time of KHTML.

Greetings
Christoph Cullmann