Disabling ‘hold to copy’ on Mobile Safari

If you want to disable the ‘Cut / Copy / Paste’ invoked by holding down on an element in Safari on the iPhone or iPad use the css:

-webkit-user-select: none;

However, as stressed by Apple, this should only be disabled on a per element basis, and never applied to the whole document.

Apple’s Technical Note TN2262: Preparing Your Web Content for iPad covers this along with using web standards instead of plugins (something that really interests me at the moment).

11 thoughts on “Disabling ‘hold to copy’ on Mobile Safari

  1. The link you’re using looks to be broken. Do you know why this shouldn’t be applied to the entire document? If you’re writing a game using PhoneGap, I think that’s what you’d want.

    • Thanks, I’ve updated the link. You’re only meant to apply it to interface elements like menus. But you’re right, for a game you’d likely want it applied to everything.

  2. I tried to implement this for a text box, and it disallowed you from even typing in the text box. Still searching for a way to programmatically disable Copy/Paste in a text box on a tablet.

    • In a mobile interface restricting cut / copy / paste on user interface elements isn’t an attempt to prevent content being copied, it’s a user experience decision.

  3. I have a button that acts like a momentary switch. Without any additional code it works fine in Chrome on my Ipad,
    works fine on Safari on my IMAC, but it does not work in Safari on my Iphone.
    If I press the button for longer than one second or so, it says: Copy | Define
    So I need to disable the select & copy.
    I have added the code below in my .html file. In the header.

    -webkit-user-select: none; /* Disable selection/Copy of UIWebView */

    However, the problem on my Iphone remains.
    How can I solve this?



Leave a Reply

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.