admin管理员组文章数量:1332329
I have a website where lots of people copy images off it, which is fine. What I do want to do, however, is help them embed it on the target website they are going to.
Ideally this would take the form where when a user right clicks the image a context menu will appear giving them easy options to embed or share the image.
What is the best way to do this?
P.s. I don't care about them hotlinking, or saving the images at all, all I want to do is provide the user with an easier way to share the images!
I have a website where lots of people copy images off it, which is fine. What I do want to do, however, is help them embed it on the target website they are going to.
Ideally this would take the form where when a user right clicks the image a context menu will appear giving them easy options to embed or share the image.
What is the best way to do this?
P.s. I don't care about them hotlinking, or saving the images at all, all I want to do is provide the user with an easier way to share the images!
Share Improve this question edited May 3, 2010 at 21:25 Chris asked May 3, 2010 at 21:09 ChrisChris 27.4k49 gold badges206 silver badges357 bronze badges 4- 3 I hate it when people add this crap to their websites. If you want to annoy your users to all hell then do something like this. – DigitalZebra Commented May 3, 2010 at 21:19
- 4 I don't think it makes a lot of sense to vote a question down because you don't like the implications of an implementation based on the answer. It's a perfectly reasonable question from the standpoint of software development. – Pointy Commented May 3, 2010 at 21:21
- It's not about preventing them from downloading it nor annoying them, most of them WANT the help so they can post the images on other websites. – Chris Commented May 3, 2010 at 21:21
- P.s. Thanks Pointy - It is impossible for you to know the context for the application for this code. Most of my users don't know that much about puters so any help I give them is better for them. What I'm trying to do is give a better user experience and reduce support emails. – Chris Commented May 3, 2010 at 21:23
3 Answers
Reset to default 7Don't send the image to their browser.
No. You can prevent the mon user from bothering, but the fact is the URL is sent to the browser to download. So at the very least I could view the source and figure it out.
If you really want to try to annoy the user, though, you can attach an oncontextmenu
event which will capture the right-click in some browsers.
edit:
In response to your ment..
Since you're using jQuery, you can use this plugin to detect right clicks. It has been tested on most browsers.
You can then use something like SimpleModal to display the modal box you want to show the user..
$('img').rightClick(function (e) {
$.modal(...);
});
You can actually render HTML as embedded mime data in all major browsers except for IE:
http://jimbojw./wiki/index.php?title=Data_URIs_and_Inline_Images
Another weird, but workable solution is to convert the image to CSS:
http://elliottback./wp/convert-image-to-css/
Neither is really that great a solution, but it highlights the fact that you need to be willing to lose an image by just putting on the web.
Even if you use a plug-in, people can just do a screen capture.
本文标签: jqueryJavascript context menu for imagesStack Overflow
版权声明:本文标题:jquery - Javascript context menu for images - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742333286a2455122.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论