by Robert Hashemian
JavaScript Web Page Load Time
Cost-free.
Note: This service comes with NO GUARANTEES. No liability is assumed.
A free and simple JavaScript (DHTML) Web Page Load Time. Just copy and paste at the top of your Web pages, perhaps right after the opening <html> tag. The load time, in seconds, will be displayed at the bottom of your page, unless the "PLT_DisplayElementID" parameter is assigned to the id of a tag anywhere on the page that can accept the innerText property (i.e. block elements), such as a div or span tag. In that case the result is dispalyed at the location of that tag. You can also customize the display format, foreground and background colors, and font size of the message. Currently works in latter versions of Internet Explorer. No message is displayed in other browsers.
This utility measures the load time of a Web page from the client's perspective. Load times are subject to connection
speeds, client and browser configurations, and response times for all elements on the entire page.
You can omit the "PLT_BackColor", "PLT_ForeColor", "PLT_FontPix", and "PLT_DisplayFormat" parameters. Default values will
be used in that case.
"PLT_DisplayFormat" allows you to format the message display to your liking.
For example, instead of the default English, you can use terms from your own language,
or make any other desired adjustments.
Set "PLT_DisplayElementID" to the id of a tag on your page that has the "innerText" property (i.e. block elements), such as a div or span tag.
If such tag is missing or not found, the result is printed at the bottom of the page.
To see the load time of any Web page use the Page Load Timer tool.
Here's the simple JavaScript Web page load time code (copy and paste at the top of Web page):
<script language="JavaScript">
PLT_DisplayFormat = "Your connection took %%S%% seconds to load this page.";
PLT_BackColor = "palegreen";
PLT_ForeColor = "navy";
PLT_FontPix = "12";
PLT_DisplayElementID = "display_here";
</script>
<script language="JavaScript" src="//www.hashemian.com/js/PageLoadTime.js"></script>
Example: The line below is coded as:
<span id="display_here"></span>.
Have a comment about JavaScript Web Page Load Time?