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).
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.
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.
Have you tried – http://sumtips.com/2011/11/prevent-copy-cut-paste-text-field.html ?
sadly not work for IOS.
This actually worked for me in iOS. Thanks!
Blocking c/c/p or any user functions is asinine, futile, and easily bypassed.
Stop being an ass.
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.
There are perfectly valid reasons for doing it. YOU stop being an ass.
Great ! ” -webkit-user-select: none; ” works great !! Thanks very much for that !
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?
Thanks,
Timo
Perfect – thank you. Working on iOS 7.
We use several iPads in our business and one of the issues we keep coming across is that some employees are using the copy & paste function for their note entries so that they don’t have to type it in each time. We’ve tried telling them not to copy and paste, that each entry should be unique for that time of entry. I have read through the entire thread above and can’t figure out what I need to do to get this to work. They use a special website that we had developed for this purpose. Every morning the notes that were entered are then emailed to each client. We have about a 3 hour window when we receive the report to when our clients receive the report. This gives us a few hours to review all entries and make the necessary corrections. If I could figure out how to disable the Copy/Paste ability altogether then I wouldn’t need to worry about anything but spelling errors.
Hi Trex – you could get your development team to make the webpage reject any pasting – pass them this link – http://stackoverflow.com/questions/1226574/disable-pasting-text-into-html-form
Hey Trex,
Bit of unsolicited advice: you’re looking at your issue from the wrong angle. You say you have an issue with people copy and pasting despite being asked to stop. Instead of putting a roadblock in front of them, address the root of the issue. It’s either easier to copy / paste for them, or there are inefficiencies in your process that makes it slower to do as you ask. Instead, attack the PROCESS. Solve your people’s issues with the process and things can change for you almost overnight. Your employees aren’t your enemy, they’re your wheels of business. Make it easier, instead of harder, to roll along for you.