Welcome to WebmasterWorld Guest from 23.20.79.227

Forum Moderators: open

Message Too Old, No Replies

Event capture in Opera

Is it actually possible?

     
9:45 am on May 29, 2002 (gmt 0)

New User

10+ Year Member

joined:Apr 30, 2002
posts:13
votes: 0


Ok i have found many sources saying it wont work with opera (speaking of right-click-protection and stuff). Is this true? Isnt there ANY way around?
12:06 pm on May 29, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


As far as I know there is no way - and that's by design. Opera is the "friendly to the user browser" and it doesn't allow many kinds of manipulation by the website that the others do.
3:11 pm on May 29, 2002 (gmt 0)

New User

10+ Year Member

joined:Apr 30, 2002
posts:13
votes: 0


Well, capturing events doesnt always mean manipulation. In my case im about to cap the right key and instead of popping up the context menu there will be a custom menu (of course "view source" isnt in it).

Actually tho, i have found to workaround by assigning the <BODY> tag the "onclick" handler, this way opera gets it. But when youre talking about remodding one js-file in 100 projects you dont want to edit each and every HTML site to make it work with the new right-click-script. You would rather just exchange the js files. Thus, the mentioned workaround isnt an option.

Im wondering why it eats
<BODY onclick="function();">

but not
document.body.onclick = function();

or
document.onclick = function();

As you see, im not about to abuse or manipulate anything, im just replacing (except that i substract the "view source" and other unimitatable functions). Opera being the "user friendliest" is the "developer meanest" at the same time...well besides NS4 of course.

11:53 pm on May 29, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:July 20, 2001
posts:137
votes: 0


try

document.body.onclick = function;

leave off the parens, you don't want to assign the return value of the function, but rather a reference to the function itself.

Opera doesn't support right click events at all. Or has someone discovered differently with the newer Opera versions?