Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Copy image in iOS web application

Is there a way of preventing the menu that appears when you hold down a finger on an image on an iPad or iPhone web application. I am creating a remote control and I use the ontouchstart and ontouchend built in functions to create my "ontouchhold" function that I implemented. That function uses the ontouchstart and ontouchend built in functions to send IR signals via my computer which is acting as the server meanwhile the user is holding down its finger against an image (the ontouchend function will clear the interval). The only problem is that if the user holds its finger to long then the javaScript function ontouchhold that I implemented stops working because a menu pops up asking the user if he wants to copy/save the image. It will be nice if I could prevent this menu from appearing.

like image 715
Tono Nam Avatar asked Feb 20 '26 23:02

Tono Nam


1 Answers

You can use:

-webkit-user-select: none;

This property makes the html elements not be not selectable and thus prevents that copy behaviour of iphone

like image 84
Varun Goel Avatar answered Feb 22 '26 11:02

Varun Goel