problem description
scaling is prohibited on mobile phone, as long as a meta tag is added. What can I do on PC if I want to prohibit scaling?
the environmental background of the problems and what methods you have tried
tried to monitor keyboard and wheel events to block default events and behave differently in different browsers
document.addEventListener("DOMContentLoaded", function (event) {
//chrome
document.body.style.zoom = "reset";
document.addEventListener("keydown", function (e) {
if ((e.ctrlKey === true || e.metaKey === true) &&
(e.which === 61 || e.which === 107 || e.which === 173 || e.which === 109
|| e.which === 187 || e.which === 189)) {
e.preventDefault();
}
}, false);
document.addEventListener("mousewhell DOMMouseScroll", function (e) {
if (e.ctrlKey === true || e.metaKey === true) {
e.preventDefault();
}
}, false);
}, false);