Tanzim Saqib on .NET discovery

Innovate. Create. Share.

  Home  |   Contact  |   Syndication    |   Login
  43 Posts | 0 Stories | 19 Comments | 0 Trackbacks

News

Photo of Tanzim Saqib Tanzim Saqib is a Senior Developer, who spent half of his life on software and worked for many companies like #1 .NET controls provider Telerik Inc, #1 personalized Web 2.0 start-page like Pageflakes (acquired by LiveUniverse). He developed many projects ranging from banking solutions for Citibank, HSBC, Wamu, Wells Fargo etc. to Paperless Virtual University. He is industry's earliest and leading widget developer and as know as "Widget Master" to his peers.

He is a preacher of Microsoft technologies. While he jams with the latest additions to .NET, in his spare time he blogs at http://weblogs.asp.net/TanzimSaqib, maintains his personal website http://www.TanzimSaqib.com, leads .NET Research group. writes articles.

He is an easy going, fun loving, and passionate technology individual who is open to any kind of business opportunity and professional relationship. He currently lives in Bangladesh, but travels anywhere in the world on professional demand.

Email: me at TanzimSaqib dot com

Archives

Post Categories

Personal

When a webpage loads, it fetches the stylesheets, javascript, images, other objects etc. So, when it is done, it's already late and user may complain about the site's poor speed of execution. One way you can make it faster, you can start JavaScript execution immediately right after the HTML DOM has finished loading and ready to traverse, before the images.

// Introduce our custom event onDOMReady 
window.onDOMReady = DOMReady  

function DOMReady(fn) 
{ 
    // According to standard implementation 
     if(document.addEventListener) 
        document.addEventListener("DOMContentLoaded", fn, false);  

    // IE 
    else 
        document.onreadystatechange = function() 
            { 
                checkReadyState(fn); 
            } 
}  

function checkReadyState(fn) 
{ 
    if(document.readyState == "interactive") 
        fn(); 
}  

window.onDOMReady( 
    function() 
    { 
        // DOM is loaded 
        // So start JavaScript execution 
    } 
);


posted on Tuesday, February 06, 2007 8:58 PM

Feedback

# re: JavaScript execution before the page has finished loading 2/12/2009 8:20 PM danilo
Great work. Thank you a lot.

Danilo

# re: JavaScript execution before the page has finished loading 11/2/2009 12:24 PM Mariano
Thats great, thanks

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: