In Safari for iPad
in iOS6
, I would like to select text and then highlight it (changing the background color) using JavaScript. However, when I do text selection a "Copy" option automatically pops up. How would I go about disabling this "Copy" option? I'm able to get this working on every other browser, except on iPad
Safari.
Is this possible? What should I do?
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;
Info from the Disabling ‘hold to copy’ on Mobile Safari, posted by Ben Collier
the -webkit-tap-highlight-color property accepts any standard CSS color value, but you’ll probably want to provide an rgba value in order to control the alpha transparency. Disabling the tap highlight is as simple as setting the alpha value to 0, like so:
container {
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
Info from Quick Tip: Customizing the Mobile Safari tap highlight color posted by Ryan Grove
So I would use css not javaScript.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With