Turn off Copy in Safari on iPad

In Safari for iPad in iOS6 , I would like to highlight text and then select it (change the background color) using JavaScript. However, when I make a selection of text, the "Copy" option appears automatically. How can I disable this "Copy" option? I can get this to work in any browser other than iPad Safari.

Is it possible? What should I do?

+6
source share
2 answers

If you want to disable Cut / Copy / Paste, it is called by holding down on an item in Safari on iPhone or iPad, use css:

 -webkit-user-select: none; 

Information from Disable 'Hold for Copy on Mobile Safari published by Ben Collier


the -webkit-tap-highlight-color property accepts any standard CSS color, but you probably want to provide an rgba value in order to control alpha transparency. Turning off the backlight is as simple as setting the alpha value to 0, for example:

 container { -webkit-tap-highlight-color: rgba(0,0,0,0); } 

Quick Tip: Safari mobile backlight color adjustment hosted by Rain Grove


So I would use css, not javaScript.

+20
source

Addition to the accepted answer;

Providing the specified property only to the host element or body element, while holding some objects (images and SVG elements, etc.), still causes a tooltip.

 * { -webkit-user-select: none; -webkit-tap-highlight-color: rgba(0,0,0,0); } 

Providing properties to all elements (*) helped.


I also assume that the select user has a problem / error with text input, so you can exclude it.

 input { -webkit-user-select: auto; } 
0
source

All Articles