Defer Content After User Sees The Page (core.js)
Monday, June 11, 2007, 10:50
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.
- 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.
- 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.
- In SharePoint Designer, Edit NoCore.aspx.
- 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” %>
- 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)
Related Posts:
Office 2007 User Tips Web Part for SharePoint
View Top 10 Questions For Each Office Application
Want some top quality Intranet content to help you users get the most out of Office 2007 applications?
Microsoft
SharePoint Custom Search Results PageThe Code Project has an article on how to create a custom search results page in SharePoint.
The built-in Windows SharePoint Services search results page (SearchResults.aspx)
How To: Creating and Using the Minimal Master PageLincoln DeMaris, a Program Manager working on Web Content Management features in Microsoft Office SharePoint Server 2007 has written a well written and thorough article
SharePoint Links 07.23.07Here are some the best articles on SharePoint that have been posted recently:
Creating a solution to deploy custom publishing items - Most of the documentation
How To Configure Employee Lookup Web Part Series - Part 2The Employee Lookup Web Part allows you the ability to search against user profiles that you import from the Active Directory. Its not a
You can follow any responses to this entry through the
RSS 2.0 feed.
Both comments and pings are currently closed.
Sharepoint link love 06-13-2007 at Virtual Generations said on Wednesday, June 13, 2007, 9:54
[...] Defer Content After User Sees The Page (core.js) [...]