Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试创建一个在线测验网站。如果用户进入测验页面,他应该不能在计算机上的其他选项卡或其他窗口中搜索答案。这样,我们将从正确的人那里得到正确的答案。我发现我们可以用 JavaScript 做到这一点。
用 JavaScript 是不可能做到这一点的。出于安全原因,JavaScript 无法控制浏览器。
在 chrome 中你可以这样做:
window.onblur = function(){ alert("Blurred"); }
我还没有测试任何其他浏览器。