swift - WKWebView disable right click menu -


i have wkwebview , want disable/remove right click menu:

enter image description here

i found similar issues:

webview load custom context menu

cocoa webview - disable interaction

but cant find

optional func webview(_ sender: webview!,  contextmenuitemsforelement element: [anyhashable : any]!,       defaultmenuitems: [any]!) -> [any]! 

method in wkuidelegate or wknavigationdelegate

you can this, not swift/objc side.

intercept 'oncontextmenu' event on html code, example:

<body oncontextmenu='contextmenu(event)'> 

then javascript :

function contextmenu(evt) {     evt.preventdefault(); } 

i deduced following post explain how customize menu:

how can context menu in wkwebview on mac modified or overridden?

regards


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -