Jump to content

Help in getting the load page time please!!!


greg

Recommended Posts

Hello Everyone,
This seems so simple, but I can't figure it out.

What I need is to record the real page load time of every webpage for every visitor.

Firstly, I have tried to calculate the time using php, but as this is server side, I can only record the time spent on running the code, not the actual time the webpage loads in the visitor browser.

Secondly, I have used javascript, and it works ok, the only problem I can’t do anything with that number. I can’t write it in the database, I can’t write it in a log file, I can’t send it by email, etc. I understand this is because when the visitor does the request, php runs first, them javascript.

I need someone give a hand on this. I would like either record every time in the database, or write a log file, or send an email (this is not so good because I will get lot of emails). If anyone knows some software to do this, please post here the name.

Please help me. I’m stuck with this project for about a week now.

Thanks
Thank you Jesirose. Do you know of any place I can get an idea of how it can be done. I have never worked with AJAX before.

This is the javascript code I use for this.
[CODE]
dt=new Date();
document.onreadystatechange=function() {
  if (document.readyState=="complete") {
    if ((PLT_Span=document.getElementById(PLT_DisplayElementID)) == null) {
      document.body.insertBefore(document.createElement("br"));
      PLT_Span = document.body.insertBefore(document.createElement("span"));
}
    PLT_DisplayFormat = PLT_DisplayFormat.replace(/%%S%%/g, ((new Date() - dt)/1000));
    PLT_Span.style.Color = PLT_ForeColor;
    PLT_Span.style.backgroundColor = PLT_BackColor;
    PLT_Span.style.fontSize = PLT_FontPix + "px";
    PLT_Span.innerText = PLT_DisplayFormat;
  }
}
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.