$(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;
}
});