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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -