This article discusses an optimization procedure for Microsoft Office SharePoint Server 2007. The article describes how to create a detached page that downloads the Core.js file but that does not reference the Core.js file on a site. When you use this method, you can delay the download of the Core.js file for anonymous users until users can view the page. In this manner, the page is rendered more quickly.
This article describes how to use Microsoft Office SharePoint Designer 2007 to create a detached page that downloads the Core.js file but that does not reference the Core.js file on a SharePoint Server 2007 site.
On an Internet-facing site, users who are on low-bandwidth connections or on high-latency connections may experience slow performance when they first browse a site. For example, it may take a long time for the first page of a site to load because of the additional resources that sometimes must be downloaded. Although resources are frequently shared between pages on a site, and although these resources are cached on the client, the first page of a site may be slow to load.
This article describes an optimization procedure for SharePoint Server 2007. By default, all pages on a SharePoint Server 2007 site contain a reference to the Core.js file. The Core.js file, in its compressed form, is 54 KB. In many areas, this file is critical to the operation of the site. However, there are some areas in which this file is not needed.
In the optimization procedure, you create a new page layout. Then, you create a new page by using that page layout. In the new page, the Core.js file is removed from the list of resources that must be downloaded before the page is rendered for an anonymous user. When content on the page is readable, the Core.js file is downloaded in the background.
Important The optimization procedure that is discussed in this article is not supported.
Then, determine whether the site-master page and the system-master page reference the same file. If they do reference the same file, the optimization in this procedure will not work. For the optimization to work, the site-master page and the system-master page must use different files.
Pages that the system-master page uses are typically in the "_layouts" folder. For example, a page that the system-master page uses may be called the "/_layouts/Settings.aspx" page.
The site-master page does not contain the following controls:
Controls that are visible to anonymous users
Controls that require the Core.js file but that do not register the Core.js file
The optimization in this procedure suppresses the Core.js file on one page, and it suppresses the file only for anonymous users. For anonymous users, the Core.js file is not downloaded to the page until after the page is readable. For authenticated users, the Core.js file is downloaded to the page before the page is readable.
You can modify the code that is mentioned in step 2 of the optimization procedure to suppress the Core.js file for users other than anonymous users. If you do this, you must also consider the site-master page.
Make sure that the site-master page does not contain ScriptLink controls that register the Core.js file. The goal of this procedure is to create a page that suppresses the Core.js file.
Note Under typical circumstances, the Core.js file is registered by the SPWebPartManager control.
To create a new page that downloads the Core.js file but that does not reference the Core.js file, follow these steps:
In SharePoint Designer 2007, create a new page layout. To do this, copy an existing page layout and then paste it to the same folder.
For example, copy ArticleLeft.aspx, and then name the new page layout "ArticleLeftNoCore.aspx."
Note To distinguish between the two page layouts, you may want to specify a new description for the new page layout that you created.
After you create the new page layout, follow these steps:
Double-click the new page layout. For example, double-click ArticleLeftNoCore.aspx. Then, at the bottom of the page, click Code.
Locate the PlaceHolderAdditionalPageHead tag, and then add the following code to the tag.
When you do this, the server does not reference the Core.js file unless the Core.js file is registered by a control.
Other master pages may use a different tag to reference the ScriptLink control. For example, the Default.master page uses the "SharePoint:ScriptLink" tag instead of the "SharePointWebControls:ScriptLink" tag.
The tag that references the ScriptLink control references the Microsoft.SharePoint.WebControls namespace. The following tag is an example of such a tag.
Create a new binary that is based on the following code. For example, create a new binary that is named "PerfTools.dll."
public class RegisterCoreWhenAuthenticatedControl : WebControl
protected override void OnInit(EventArgs e)
This code tells the server to reference the Core.js file if the user is not anonymous. This operation is performed because the Site Actions menu requires the Core.js file. By default, many authenticated users have access to the Site Actions menu on the site.
Your environment may require that you suppress the Core.js file under different circumstances. In this environment, use code that is appropriate to your needs.
Be aware that the OnInit method is run any time that the page is loaded. Therefore, make sure that you do not add code that adversely affects throughput on the server. For example, if you add code that accesses the current SpListItem component, a round trip to the Microsoft SQL Server database is likely to occur.
After you create the new binary, follow these steps:
Set the version of the binary to 188.8.131.52.
Add the binary to the global assembly cache on the server.
Open the Web.config file on the server, and then add the following code to the set of SafeControls controls.
This code enables the new page layout to reference the CorePreLoad.aspx page. All items on the page are displayed before the CorePreLoad.aspx file is loaded to perform its function.
Check in the new page layout, and then publish it.
Use the new page layout to create a new page.
When anonymous users browse the new page, the Core.js file does not have to be downloaded before the user can view the page or before the user can interact with the page.
For example, you use ArticleLeft.aspx to create a new page, and then you use ArticleLeftNoCore.aspx to create another new page. Although both new pages are identical, one new page references the Core.js file and the other new page does not.
Test the new page that you created to make sure that all controls work correctly.
If controls do not work when anonymous users browse the page, remove the controls from the new page. Alternatively, remove the controls from the new page layout. The optimization in this procedure assumes that the new page does not require the Core.js file because no items on the page require the Core.js file.
Make sure that the Core.js file still appears on other pages on the site. Browse other pages on the site to verify that the Core.js file appears on those pages.
To verify that the optimization in this procedure works correctly, browse the new page as an anonymous user, and then view the source code on the page. Confirm that a reference to the Core.js file does not exist. Then, view the cache. Confirm that the Core.js file is downloaded to the server. Only the page that you created from the new page layout does not reference the Core.js file. Other pages on the site will continue to reference the Core.js file.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.