I am trying to write a Google Chrome extension to basically favorite pictures. So you see a picture on a page that you want to remember but don’t want to manually save it or save the image URL. You will be able to right click on the image and add it to your image favorites with this extension.
I have everything figured out except for when the user right clicks on the picture, I can’t figure out how to get the image URL from that action. The solution would need to work on any normal page on the internet. I am not sure if I need a normal listener or what.
Your context menu item’s
onclickhandler should expect anonClickDataobject as its first argument. This object will contain asrcUrlproperty, which is thesrcproperty of the image that was right-clicked.You’d set up your menu item like this: