Defer Content After User Sees The Page (core.js) - SharePoint Buzz - Your SharePoint Community Resource

SharePoint Buzz on Twitter

    sptechcon 2010


    Defer Content After User Sees The Page (core.js) 

    Defering content after users sees the page can be very beneficial. Why? Using this technique, the page is rendered much more quickly, while the user's experience of interacting with the site is not negatively impacted. If you’ve implemented or are planning to implement a Internet facing website, you are probably exploring all avenues to make it more responsive to users and visitors. For some users – particularly those with low-bandwidth or high-latency connections – the very first page load of a site can take a long time because of all the resources which need to be downloaded along with the page markup itself. Although these resources are often shared between pages and cached on the client, the first page load can be painfully slow. Having satisfied the above criteria, you can now be confident that the site is ready for this optimization.
    1. Create the page, which is not to reference core.js. We’ll call it NoCore.aspx, but in your case, default.aspx might be more appropriate since that’s the default Home Page for your site.
    2. In SharePoint Designer, navigate to NoCore.aspx in the tree hierarchy, right click, and select “Detach from Page Layout.” This will have the effect of converting NoCore.aspx to an “untemplatized page.” What this means is that while it is still subject to the site wide Master Page, its markup is no longer governed by the layout from which it was created, and you will be able to update the markup as you see fit.
    3. In SharePoint Designer, Edit NoCore.aspx.
    4. Inside the tag with ID PlaceHolderAdditionalPageHead, Add the following markup:This has the effect of telling the server that unless core.js is specifically registered by some control, it should not be referenced. Note that this example was created using BlueBand.master, but other master pages may have a different tag required to reference the ScriptLink control.For example, in default.master, the tag would be SharePoint:ScriptLink instead of SharePointWebControls:ScriptLink. The correct tag will be referencing the Microsoft.SharePoint.WebControls namespace, and looks something like this:
      <%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    5. Create a new binary based on the code in Appendix A, and set the version to “1.0.0.0”. In my example, this new binary is called PerfTools.dll.The purpose of this code is to tell the server that if the user is not anonymous, we want the page to specifically register core.js. We do this because by default, many authenticated users will have access to the Site Actions menu, which requires core.js, while anonymous users do not. Your scenario may require that you suppress core.js under different circumstances, and if so, this is the code to change. Please note that the OnInit method will be executed any time the page is loaded, so you will want to ensure that you do not add any code which would adversely impact the throughput on the server. Accessing the current SPListItem, for example, will most likely incur a round trip to the SQL database.
    Read the rest of the article by the SharePoint Team on building a detached page that does not reference core.js (but downloads it while the page is being viewed thereby optimizing response time)
     
    Posted on 11-Jun-07 by Kanwal Khipple
    0 Comments  |  Trackback Url  |  Link to this post | Bookmark this post with:        
    Tags:
     

    Links to this post

    Comments

    Name:
    URL:
    Email:
    Comments: