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

禁用长按选择文字功能

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:禁止长按弹出的菜单");
}

posted @ 2020-08-14 18:09  ZerlinM  阅读(1092)  评论(0编辑  收藏  举报