从网站中删除文本选择限制的脚本

Script to remove text selection restriction from a website

本文关键字:脚本 选择 文本 网站 删除      更新时间:2023-09-26

因此,有一个站点1和站点2使用以下脚本禁用right clickmouse selection

document.body.oncopy = function(e){
    if (window.clipboardData) window.clipboardData.clearData();
    return false;
};    
document.body.onselectstart = function(e){ return false; };    
document.oncontextmenu = function () { return false; }

我已经尝试使用以下命令删除选择限制:

// works for site1 and site2
document.oncontextmenu = null 
// not working for site2
document.body.onselectstart = null
document.body.oncopy = null
$(document).unbind();
$(document.body).unbind();

但是site2的选择限制没有取消,如何从Chrome的javascript控制台中删除这些事件?

我检查过他们似乎在使用css来disable选择

.noselect {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
<p>
  I am Selectable text.
</p>
<p class="noselect">
  You can't select me ! give it a try.... told you!
</p>