To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-27-2006, 07:18 PM   #1
DrDel
Junior Member
 
Join Date: Jan 2006
Posts: 1
Angry Need Help with JScript Problem (http.open) to Time a Webpage Read

I am trying to track how long a reader reads a webpage on my site for stastical reasons.

I am trying to build a script that updates the mySQL database with the time duration for reading the page (var milDiff ).


The JS Console doesn't like my http.open('GET' command - keeps denying my persmisson to it I don't know why

Error: uncaught exception: Permission denied to call method XMLHttpRequest.open

All the scripts reside under the same domain name on the same webserver

any advice?

Here is my first attempt at anything remotely AJAX:

<html>
<head>
<title>Test Page</title>
<script type='text/javascript'>
var startTime = null;
window.onload = function () {
startTime = new Date();
}

window.onunload = function ( ) {
var endTime = new Date();
var milDiff = Math.abs(startTime - endTime);
alert( milDiff );

if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http = new ActiveXObject("Microsoft.XMLHTTP");
}

http.open('GET', 'http://www.foo.com/path/savetime.php?readTime=' +milDiff, true);

http.onreadystatechange = function() {
if (http.readyState == 4) {
document.getElementById('some_div_id').innerHTML = http.responseText;
}

}
}
</script>
</head>
<body >
</body>
</html>
DrDel is offline   Reply With Quote
Old 05-30-2006, 07:42 AM   #2
Pompiuses
Junior Member
 
Join Date: Nov 2003
Posts: 21
Did you ever figure this one out?
Pompiuses is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 06:55 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.