How to disable long-press gesture in WKWebView?

DannyPhamDannyPham USMember ✭✭

Hello, I'm using Xamarin Forms WebView with a custom renderer for using iOS WKWebView to load a website in my app. I was trying to disable the long-press gesture in WKWebView, but couldn't. Do you have any ideas about this? Thanks in advance.

Best Answers


  • LandLuLandLu Member, Xamarin Team Xamurai

    Why do you want to disable that?
    Which effect of long pressed gesture do you want to avoid?

  • DannyPhamDannyPham USMember ✭✭
    edited August 15

    @LandLu because when a user uses that gesture, the website link will popup and it can be shared to anyone. I don't want that to happen.

  • DannyPhamDannyPham USMember ✭✭
    edited August 21

    @LandLu From what you've said, I went into the web page's source code and modified the css file, but the issue still persisted. I've added "-webkit-touch-callout: none;" to the html, body, and to the link, but it didn't work. Do you know how I can prevent the long press gesture by editing the webpage's source code? Thank you.

    html, body {
    -webkit-touch-callout: none;

    .mck-box .mck-nav > li > a {
    position: relative;
    display: block;
    padding: 10px 15px;
    -webkit-touch-callout: none;

  • DannyPhamDannyPham USMember ✭✭

    @LandLu yes it works. Thanks a lot for your help.

Sign In or Register to comment.