-1

How do I disable the "Save Target As" item in right click menu in Internet Explorer and Firefox browsers?

Michael Kniskern
  • 24,792
  • 68
  • 164
  • 231
sivakumar
  • 1,547
  • 9
  • 21
  • 28

4 Answers4

10

You can't.

You can attempt to block the context menu entirely (which is annoying, and very very easy to bypass), but you can't do anything about individual options on it.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • You can create your own custom context menu if you want. http://stackoverflow.com/a/20471268/3050426 – pravin Mar 20 '15 at 07:12
3

Read this page - both for a way to disable the context menu, and the reason why you shouldn't. As for disabling individual menu items, that's not possible since those items are determined by the browser and kept isolated from the page itself.

Amber
  • 507,862
  • 82
  • 626
  • 550
3

There is another option for that! You can prevent the user save your image by using the pointer-events css property:

img {
  pointer-events: none;
}

Essentially what that's going to do is block any mouse events to img elements. You still going to get a dialog box but that is the same you get with background images.

https://developer.mozilla.org/pt-BR/docs/Web/CSS/pointer-events https://css-tricks.com/almanac/properties/p/pointer-events/

Mateus Sarmento
  • 153
  • 1
  • 7
  • I love this. It doesn't interfere with accessibility software, it doesn't interfere with other browser functionality, and it won't piss your users off because they're used to not being able to copy or save-as on background images anyway. – Jay Irvine Dec 17 '21 at 22:26
  • I love this approach!!! thank you so much – Ewomazino Ukah May 16 '22 at 11:55
1

Not possible. You could try blocking the context menu by adding the following to your body tag:

<body oncontextmenu="return false;">

This will block all access to the context menu (not just from the right mouse button but from the keyboard as well)

Omar Wagih
  • 8,504
  • 7
  • 59
  • 75