html,
body {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
<body oncontextmenu="return false" onselectstart="return false">
//禁止页面选择以及鼠标右键
document.oncontextmenu = function() {
return false;
};
document.onselectstart = function() {
return false;
};
// 禁止复制和选中操作
document.body.onselectstart = document.body.ondrag = function() {
return false;
}
// 禁用双击放大
var lastTouchEnd = 0
document.documentElement.addEventListener('touchend', function(event) {
var now = Date.now()
if (now - lastTouchEnd <= 300) {
event.preventDefault()
}
lastTouchEnd = now
}, {
passive: false
})
禁止选中事件和双击放大事件
最新推荐文章于 2024-04-22 17:20:13 发布