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
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.