UIWebview disable right-click

Reading Time: 1

Ever used the UIWebview in an iOS app to show html content? One of the problems when using this approach is that a long press (and hold) on the view shows the popup menu which allows you to copy stuff etc.

I’ve seen many approaches for disabling interaction with the website AND keeping click behaviour intact but none works as good as the following:

This will disable the javascript interaction that triggers the menu but leaves the clicking interactions intact, thus keeping the html content’s interactions as-designed.

I found this clean solution in the approved answer on this question over on StackOverflow.