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 –