sindresorhus/electron-context-menu

[HELP] get link when right click

shashankx86 opened this issue · 2 comments

Is it possible to get link with right click in it
When I right on anything if it has link show open in browser

I want to add Open in browser option in menu

You can use the prepend option to add your own menu item.

You can use the provided https://electronjs.org/docs/api/web-contents/#event-context-menu object to check whether the right-clicked element is a link.

	contextMenu({
		prepend: (defaultActions, parameters, view) => [
			{
				label: "Open in New Tab",
				visible: (parameters.linkURL) ? true : false,
				click: (menuItem, browserWindow, event) => {
					// here you can use parameters.linkURL
				}
			}
		],
		window: myBrowserWindowOrBrowserView
	});