Disable the pop-up box when H5 page in IOS system long presses a label

Time:2020-4-22

Use scenario

<a href="javascript:void(0)" >Link</a>

In the process of web page development, this method is often used to prevent the jump behavior of a tag link,
But in IOS system, long press a label and a prompt box “JavaScript” will pop up.

At this time, add CSS to a tag to solve the problem

-webkit-touch-callout:none;

-webkit-touch-callout

This feature is non-standard and is not part of any specification.

-The WebKit touch callout CSS property controls the display of default annotations that are displayed when you click and hold the touch target.

When you touch and hold the target on iPhone OS, Safari displays annotation information about the link. This property allows the behavior to be disabled.

Apple has instructions in the safari CSS reference.

Related reading:

https://www.jianshu.com/p/b0a…

https://cloud.tencent.com/dev…

https://developer.apple.com/l…