473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Measuring Web Download Time (client Vs server side)

Dear Experts:

I am trying to measure a HTML page download time on the client side
and store the value into a textfile located in the server.

I have successfully measured the page download time (client-side)
using JAVASCRIPT and write this value into a textfile in the server
using PHP script. No problem so far.

I call my PHP script using JAVASCRIPT (myPage.HTML):

<BODY ONLOAD = if (first time entering this page) MyPHPScript >

where

MyPHPScript: PHP script that writes values on the server

The problem is after the value is written to the textfile
(server-side), I want the program to go back displaying the HTML page
and finishes where it left off. However with the way I do it, I keep
getting infinite loop. This is the reason:

1. in myPage.HTML => 1st time it reaches BODY ONLOAD -> it'll call
MyPHPscript
2. in MyPHPScript => I redirect the page back to myPage.HTML
3. in myPage.HTML => 2nd time it reaches BODY ONLOAD -> it'll call
MyPHPscript(AGAIN!!)
4. Back to step #2, then to step #3....(infinite loop)

My goal is to prevent the client from knowing that I am calling
MyPHPScript in between my HTML pages. I have about 50 HTML pages right
now that are already running very well and would like to measure the
download time for each page on the client side. I try to minimize my
interference with the original flow of the existing system.

Your help would be greatly appreciated.
Jul 20 '05 #1
2 3466

"duane" <du******@hotmail.com> schreef in bericht
news:59**************************@posting.google.c om...
Dear Experts:

I am trying to measure a HTML page download time on the client side
and store the value into a textfile located in the server.

I have successfully measured the page download time (client-side)
using JAVASCRIPT and write this value into a textfile in the server
using PHP script. No problem so far.

I call my PHP script using JAVASCRIPT (myPage.HTML):

<BODY ONLOAD = if (first time entering this page) MyPHPScript >


Try it the way the advertisement guys are doing it:

<html>
....
<script type="text/javascript">
function isReady() {
if ( document.cookie.indexOf('processed') > -1 ) {
// Avoid caching by appending a random number to the URL
random = new Date().valueOf();
document.images['readygif'].src = 'thephpfile.php?' +
random;
// Create a cookie to remember that this page has been
visited
document.cookie = "processed=1";
}
</script>
....
<body onload="isReady()">
...
<img src="dot.gif" name="readygif" height="1" width="1" />
</body>
</html>
Then, thephpfile.php would contain something like this:

<?
// Mark whatever information you need

header("Content-Type: image/gif");
// include a basic gif image that you have prepared
// or generate one using the GD functions
?>
HTH,
JW

Jul 20 '05 #2
Thank you JWB =)

It works like a charm!
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: D. Alvarado | last post by:
Hello, I would like to design a page that measures the user's download connection. Does anyone have an example link or script that might aid me in this task? Thanks, - Dave
6
by: S P Arif Sahari Wibowo | last post by:
Hi! I am thinking to have a client-side script doing processing on file downloading, basically the script will process a downloaded file from the server before it received by the user. For...
3
by: Skwish | last post by:
Hi, I would like to download all the files from a folder (of various types i.e. ..txt, .dll, .dat, etc.). I tried Dim MyDir As IO.Directory Dim path As String = Me.MapPath(".") & "\Data" Dim...
13
by: bmurphy | last post by:
Last week after much searching, I found the answer to my problem in this newsgroup. I can't find the thread from which I got my solution, but I wanted to report back what worked. When the site...
2
by: Jan Paul van de Berg | last post by:
I have a piece of software that people can download and a third party promoting that software. In order for them to be able to count the number of downloads, I have to put a tracking code on my...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
3
by: Alex K | last post by:
Hello, Would it be possible to make the browser download a resource using javascript? I'm aware there could be a security issue but I'm still wondering if this could be possible. It could save a...
9
by: Ross | last post by:
I'm a newbie at this, and have searched a lot but can't find something that seems appropriate for measuring a recurring elapsed time. Creating an object with: var mydate = new Date(); seems...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.