来源:
宝武微学院 http://mooc.baosteel.com
移动网大、移动网校 https://wangda.chinamobile.com
1、如何避免考生考试过程切屏去搜寻答案?
使用JavaScript自带的全局方法屏蔽考生作弊
window.onmouseleave = window.onblur = window.onmouseout = document.onmouseleave = document.onblur = document.onmouseout = document.body.onmouseleave = document.body.onblur = document.body.onmouseout = onmouseleave = onblur = onmouseout = function(){
};
'2、如何防止考生复制考试题目或者答案内容?
window.onselectstart = document.onselectstart = document.body.onselectstart = onselectstart = document.querySelector("html").onselectstart = function(){
};
window.oncopy = window.onpaste = document.oncopy = document.onpaste = document.body.oncopy = document.body.onpaste = oncopy = onpaste = function(){
};;
'3、如何防止考生用右键菜单复制内容?
window.oncontextmenu = document.oncontextmenu = document.body.oncontextmenu = oncontextmenu = document.querySelector("html").oncontextmenu = function(){
};
'4、如何防止学生用快捷键唤起检查模式的弹窗来试图破解考试屏蔽的情况?这里针对ctrl+shift+C以及F12做了屏蔽。
window.onkeyup = window.onkeydown = window.onKeyPress = document.onkeyup = document.onkeydown = document.onKeyPress = document.body.onkeyup = document.body.onkeydown = document.body.onKeyPress = onkeyup = onkeydown = onKeyPress = function(){
};
'