移动端禁止长按弹出菜单及选中文字

禁用长按选择文字功能

body {
    user-select: none;
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none;
}

禁止长按弹出菜单

(未实际验证)

node.addEventListener('contextmenu', function(e){
    e.preventDefault();
  });
node.ontouchend = function () {
    throw new Error("NO ERRPR:禁止长按弹出的菜单");
}

原文地址:https://www.cnblogs.com/ZerlinM/p/13503700.html