Page Loading Time in jQuery


In this article, I explain how to show page load time using jQuery.

First we download the file and then add it to our project; the file is:


Use the following procedure.

Step 1

Open Visual Studio 2012 and click "File" -> "New" -> "Web Site...". A window is opened. In this window, click "Empty Web Site" under Visual C#.

Give the name of your application as "Page_Load_Time_in_Jquery" and then click "Ok". Then add "HTML page" and write the following code.

Program Coding


<html xmlns="">


<title>Page load time</title>

<script src="jquery-1.8.2.js"></script>

<script type="text/javascript">

    $(function ()


        var befretime = new Date().getTime();

        window.onload = gettimeload;

        function gettimeload()


            var aftertime = new Date().getTime();

            // Time calculating in seconds

            time = (aftertime - befretime) / 1000







    <h3 style="color: #0000FF">Page load time in Jquery</h3>


your Page load in

<label id="lbltxt" style="font-weight:bold; color:Red"></label>








Refresh or Reload the page; you will see that the page load time has changed.


For more information, download the attached sample application.