Right-click in Webkit view mode.

I am currently working on a project in Ruby, which is essentially a web application. We love the web application format and some of the natural flexible benefits that we have for the web. However, we want to be able to package our application and distribute it offline.

Ideally, we would like to make the .app package for Mac and .exe for Windows, which simply opens the Webkit view, connects to our server and displays the HTML code that we serve it.

It’s not so difficult, although this slightly exceeds our current experience (especially the development of Windows), but all are surmountable.

The problem is that we would like to enable right-click as you can in the iTunes store (which is a Webkit view that has custom events for right-clicks). We also want our application to also add special keys with a right-click, and they act according to context.

What should we do? Where can we start?

+3
source share
1 answer

Do you want to do this from your web application or from your native application?

Cocoa, webView: contextMenuItemsForElement: defaultMenuItems: WebUIDelegate NSMenuItem, .

-, "contextmenu", :

document.addEventListener("contextmenu", function(event) {
    event.preventDefault();
    console.log("My spiffy custom right click menu here!");
}, false);

, -, , .

+2

Source: https://habr.com/ru/post/1729720/


All Articles