$(window).unload(function() {
var c = confirm("Are You want to open Foortal.pk");
if (c) {
window.location.replace("http://www.google.com")
return true;
} else {
return false;
}
});
我不知道问题
$(window).unload(function() {
var c = confirm("Are You want to open Foortal.pk");
if (c) {
window.location.replace("http://www.google.com")
return true;
} else {
return false;
}
});
我不知道问题
工作演示 http://jsfiddle.net/FUXRF/
阅读此 ==> https://forum.jquery.com/topic/jquery-onbefore-unload-and-page-redirect
:)
我希望每个人都能像火箭一样工作
代码
$(window).unload(function() {
var c = confirm("Are You want to open Foortal.pk");
if (c) {
alert(window.location);
// window.location.replace("http://www.google.com");
window.parent.location = "http://www.google.com";
return true;
} else {
return false;
}
});
$(window).trigger('unload');
window.parent.location ="http://www.google.com";
用那个代替
window.location.replace("http://www.google.com");
你忘了';' 上
window.location.replace("http://www.google.com");
我们这样做
$(window).bind("beforeunload", function(){
return "Are you OK?";
});
尝试
$(window).bind("beforeunload", function(){
var c = confirm("Are You want to open Foortal.pk");
if (c) {
window.location("http://www.google.com");
return true;
} else {
return false;
}
});