I have page unload javascript that is working fine, but not in IIS ,Do I need to give any permission in IIS for this?Here is my javascript that is not working
window.onbeforeunload = InitializeService;
function InitializeService() {
InitializeService1();
if (checkdisposition.disposition == "") {
var agree = confirm("You Did Not Save Disposition, Are You Sure You Want To Navigate?");
if (agree) {
return true;
}
else {
return "You Did Not Save Disposition ";
}
}
}
function InitializeService1() {
if (window.XMLHttpRequest) {
var url = "http://localhost:54329/WebServices/PageUnloadCall.asmx?op=Page_Unload";
myReq.onreadystatechange = checkStatus1;
myReq.open("GET", url, false); // true indicates asynchronous request
myReq.send();
}
}
What are your site’s Urls for “non IIS case” and “IIS case”? You could be hitting cross domain restriction when opening Web request to “http://localhost:54329” in IIS case (since site would be different (usually http://localhost:80).
Note that as @Juan Mendes pointed out the XMLHttpRequest may not work at all at that time and definitely will not return asynchronous results before page finish closing.