1
Answer

javascript ,jquery

Photo of Ravi Patel

Ravi Patel

10y
675
1
i want to call logout page on browser close or tab close?
 
 
why this code is not working in Firefox an and google chrome  ? but working in IE  on Browser close or tab close
 
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
var clicked = false;
function CheckBrowser() {
if (clicked == false) {
window.location = "../Security/logOut.aspx";
// Browser closed
}
else {
alert('false');
redirected
clicked = false;
}
}
function Logout() {
if (clicked == false)//browser is closed
{
//window.location = "../Security/logOut.aspx";
alert('close the browser?');
var request = GetRequest();
alert('close the browser'+request );
request.open("GET", "../Security/logOut.aspx", true);
request.send();
}
}
function GetRequest() {
var xmlHttp = null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}
catch (e) {
//Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
</head>
<body onbeforeunload="Logout()" onclick="clicked=true;">
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
 

Answers (1)

0
Photo of Vulpes
NA 98.3k 1.5m 13y
As Sam intimated, it works much the same as Microsoft's .NET platform.

They have a Mono C# compiler which is written in C# itself (Microsoft's compiler is currently written in C++).

This produces Common Intermediate Language (CIL), which runs under the control of their version of the Common Language Runtime (CLR). It is converted 'on the fly' by their just in time compiler (JIT) to native code for whatever platform it's running on at the time. It can target; Linux, Mac OS X and Windows amongst others.

They have also built from scratch their version of the basic framework classes plus some additional stuff for Linux etc.
0
Photo of Sam Hobbs
NA 28.7k 1.3m 13y
It works by executing machine instructions resulting from compiled source code written by programmers.

It you want a more specific answer, please be more specific in your question.