我只是想知道爲什麼這不與IE瀏覽器一起工作。它適用於Chrome和Firefox。onBeforeUnload with ajax無法與IE
window.onbeforeunload = function()
{
fetch("http://"+window.location.hostname+"/process_sc.php?cC=" + 1);
}
function fetch(url) {
var x = (window.ActiveXObject) ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
x.open("GET", url, false);
x.send(null);
}
你爲什麼要在「onbeforeunload」上調用Ajax .... – 2012-02-28 10:39:59
https://developer.mozilla.org/zh-CN/DOM/window.onbeforeunload – Joseph 2012-02-28 10:46:05
@Sudhir爲什麼?還有其他方法嗎? – jaypabs 2012-02-28 12:01:46