0
我正在创建一个需要密码才能访问的站点,但一旦密码提示启动后,返回就太困难(不方便用户了)。密码的目的是防止用户看到页面和页面源。
这里是我迄今:如果按下取消,关闭标签/重定向?
do{
$('html').hide(); //hiding html with jQuery
var pass = "password"; //setting password
var selection = prompt("Enter password", ""); //prompting for password
if(selection == "cancel"){
window.location.href = "http://www.example.com/";
}; //trying (unsuccesfully) to make the page redirect if user answers "cancel"
} while(selection!=pass);
我需要它重定向时,取消按钮被按下,这是不是在我的测试中发生 –
我更新了答案:) – hansottowirtz
非常感谢:D –