IE浏览器禁止文字选中,禁止图片拖拽,禁止缩放。

关于IE浏览器的一些简单设置。

一.禁止文字选中有两种方式:css和js.推荐使用js方式

css:

body{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

js:

 <body id="content"></body>

$(content).attr('unselectable','on')
          .css({'-moz-user-select':'-moz-none', 
          '-moz-user-select':'none', 
          '-o-user-select':'none', 
          '-khtml-user-select':'none', 
          '-webkit-user-select':'none',
          '-ms-user-select':'none', 
          'user-select':'none' 
          }).bind('selectstart', function(){ 
          return false;
 });

二:禁用图片的拖拽

window.ondragstart=function(){
    return false;
}

三:IE禁止缩放(禁用触屏的双击放大和鼠标的ctrl+滚轮)

进入注册表(window+R然后输入regedit)进入HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Zoom目录下,新建名字为ZoomDisabled类型为REG_DWORD值设置为1即可。如下图所示:

猜你喜欢

转载自blog.csdn.net/fk478561641/article/details/82587725