解除网页的右键菜单、选择、复制限制(IE不适用)

function unlock(currWin){
    with(currWin.document){
        ondragstart = onselectstart = onselect = onbeforecopy = oncopy = onpaste = onkeydown = oncontextmenu = onmousedown = onmouseup = function(){return true};
        var all = getElementsByTagName('*');
        for ( var i = 0 ; i < all.length ; i++){
            var win = all[i].contentWindow;//若win不为undefined,则all[i]为iframe
            if(win)
            try{
                win.document;//跨域会出错
                arguments.callee(win)
            }catch(e){
                console.log("跨域咯")
            }
            with(all[i]){
                ondragstart = onselectstart = onselect = onbeforecopy = oncopy = onpaste = onkeydown = oncontextmenu = onmousedown = onmouseup = function(){return true};all[i].style.cursor="auto"
            }
        }
    }
}
unlock(this)

Chrome测试通过 。。