0
시스템을 사용하여 사용자 활동을 추적하고 있습니다. 그것은 크롬에서 매력처럼 작동하지만 내 db에 'end_start'를 쓰지 않고 페이지 결과가 여전히 열려 있기 때문에 Firefox와 Safari (window.close로 인한 것 같습니다)에서 작동하지 않습니다.XMLHttpRequest 추적 문제 (Firefox 및 Safari에만 해당)
jsHandler
function start(pageName) {
var xmlhttp3;
if (window.XMLHttpRequest) {
xmlhttp3 = new XMLHttpRequest();
} else {
xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp3.onreadystatechange=function() {
if (xmlhttp3.readyState==4 && xmlhttp3.status==200) {
}
}
xmlhttp3.open("GET","includes/trackStart.php?pageName="+pageName,true);
xmlhttp3.send();
}
function end() {
var xmlhttp3;
if (window.XMLHttpRequest) {
xmlhttp3 = new XMLHttpRequest();
} else {
xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp3.onreadystatechange=function() {
if (xmlhttp3.readyState==4 && xmlhttp3.status==200) {
}
}
xmlhttp3.open("GET","includes/trackEnd.php",true);
xmlhttp3.send();
}
HTML
<script src="../includes/jsHandler.js"></script>
<script>
window.onload = function(){ return start('<?php echo basename($_SERVER['REQUEST_URI'], '?' . $_SERVER['PATH_INFO']); ?>');};
window.onbeforeunload = function(){ return end(); };
window.onclose = function(){ return end(); };
</script>
는 감사 된 .js!