# 禁用图片灯箱上的右键点击

**URL:** <https://meta.discourse.org/t/disable-right-click-on-image-lightbox/95771>\
**Category:** Development\
**Created:** [2018年八月27日 19:31 UTC](https://meta.discourse.org/t/disable-right-click-on-image-lightbox/95771 "2018-08-27T19:31:47Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [2018年九月5日 00:59 UTC](https://meta.discourse.org/t/disable-right-click-on-image-lightbox/95771/7 "2018-09-05T00:59:16Z")

</div>

Sorry, lost track of this and just noticed your marketplace post

Does this work for you when added to /head?

```JS
<script type="text/discourse-plugin" version="0.8">

const TopicRoute = require("discourse/routes/topic").default;

TopicRoute.reopen({
	activate: function() {
		this._super();
		Em.run.next(function() {
		    $('body').on('contextmenu', '.cooked img, .mfp-img', function(e){ return false; });
		});
	}
});
</script>

```

---

_[View the full topic](https://meta.discourse.org/t/disable-right-click-on-image-lightbox/95771)._
