How to trap mouseDown in wkWebView or WebView

Subclassing WebView and adding a mouseDown method does not trap the event. I presume the same is true for wkWebView. Is there some way to trap mouseDown and send it to a different position in the view?

Use Javascript.

I last used Javascript 20 years ago. I have forgotten most of it. This is a conventional objective c app. Can you give me some guidance here.

You said it was a webview app. That means you are using Javascript. Just search for "mousedown" on Stack Overflow or somewhere. Take your pick for any of the dozens of responses.

Not to beat a dead horse, but it is a Mac OS app. WebView is an object available within Mac OS realm as well as withing the webView app realm. JavaScript is not necessily envolved, but I'm sure there must be a way to use it.


Thanks for your help.

The horse is dead, Jim. WebKit is hacked into the operating system at a very low level. You are welcome to spend a few months trying to debug and reverse engineer it if you want. If, by some longshot, you ever do figure it out, 10.15 "Death Valley" is going to drop and re-write the whole thing. This is trivially easy to do in Javascript. Then your Javascript can call back into the Mac side to do whatever you need.

OK. Thanks. I'll look into it. I had given up all hope and just read your reply now. I'll see what I can do.

thanks to JD for his great explanation and non-patronising answer.

How to trap mouseDown in wkWebView or WebView
 
 
Q