views:

271

answers:

4

I have to create an image gallery where user can select some images and then process them. The selection should be done via Ctrl+LeftClick of the mouse. It works well in FF and IE8, but when I Ctrl+click in Opera, new dialog "Save as" appears which causes saving the clicked image.

How do I prevent opening the dialog in Opera? (it's probably system setting) I haven't still found any solution. The question at Opera remains unanswered since June,2008 :(

Is it even possible? Ctrl+Click is standard way in OS, that's probably the problem - adapting desktop behaviour to web.

+1  A: 

I don't believe this is possible - I'd advise a different key mapping for Opera (or indeed all browsers)

For example, Opera has an option where the right click context menu cannot be disabled by javascript - as a protection for Opera users.

David Caunt
I've read about the problems with context menu and saw there are maybe some workarounds. However, I can not tell each client "if you want to use my product, change settings in your browser". Some of them may not know that there are some settings.
stej
Absolutely. I'd advise a different key mapping, or as scunliffe suggests, modify your UI so that a click selects an object, rather than navigating. You can stop the event to prevent the link being followed.
David Caunt
+1  A: 
scunliffe
Unfortunatelly it is not possible. After click on the preview (that could be selected) user is redirected to a new page with full image. (so the <img /> is wrapped in <a />).
stej
+1  A: 

In Opera, it is possible to set this behavior in Tools->Preferences->Content->JavaScript Options->Allow script to detect context menu events. This is unchecked by default, which means that most users will see the browser's context menu.

This was added to prevent "context menu hijacking"; unfortunately, this limits all browser apps to the left mouse button. You could have the user rightclick->Edit site preferences->Scripting->Allow script to detect context menu events; this should allow your site to use this functionality.

Piskvor
A: 

If you're attempting to prevent people from saving image it is pointless. All the user needs to do to get around context-menu-hijacking is disable JavaScript temporarily on that page, or press PRINT SCREEN.

Diodeus
Or just go to browser cache on disk and simply copy the images. No, I only want the possibility to un/select them.
stej