In the new SharePoint 2013 app model, the apps can be hosted in one of the following hosting models: SharePoint Hosted (within SharePoint domain), provided hosted, and auto hosted (outside SharePoint domain).
One of the biggest issues that we can see with the apps running outside the SharePoint domain is the branding, since these apps have separate homes or landing pages than SharePoint and do not follow visual paradigms like navigation menus, back links to home pages and so on similar to SharePoint.
Intranet users can feel disconnected from the app due to this huge gap in the UI experience.
In order to overcome this obvious issue, SharePoint allows us to import a very basic version of SharePoint 2013 Chrome into their apps without applying the custom CSS styles manually by means of a client side rendering control called “Chrome Control”.
The functional implementation details of this control reside in “SP.UI.Controls.js”file located in the new “/_layouts/15” virtual directory or “Layouts” Folder in 15 Hive.
By now, you must have a fair understanding of Chrome control and now is the time to move on to see it in action.
In order to demonstrate this implementation of Chrome control, we will start with a provider hosted app, as shown in the below steps:
Create a new SharePoint app project by selecting “App for SharePoint” project template.
Choose hosting model as “Provider-Hosted”.
Choose “ASP.Net Web Forms Application” as a template for provisioning the remote site.
Specify the Certificate location, decrypting the password and issuer ID (This ID was generated, while we configure the S2S trust for provider hosted apps),
Once the project has been added to the solution, it would look like this:
I have added a dummy feature to force SharePoint to create an app Web for this app, though this is purely optional, as shown below:
We can review the app Web, using any SharePoint Object Browser. Here, I am using SharePoint Manager to look at the same.
Also, notice that we have changed the start page for the app to “ChromeCrossDomain.aspx”, as highlighted below:
Allowing read permission for the app in site collection hosting it in AppManifest.xml is shown below:
Also, in the remote Web project, we have the pages folder, which contains the pages for our app.
We have “ChromeCrossDomain.aspx” page residing inside this folder, which will serve as a start page for this app, as shown below:
Similarly, we have a Scripts folder, which is holding all JavaScript Files in use by this app, as shown below:
Apart from standard JavaScript Files supporting JQuery, we also have two app specific custom JavaScript files “ChromeLoader.js” and “CrossDomainExecutor.js”, which is implementing the core of Chrome control for this app, shown below:
In the start page HTML, follow the steps given below:
First, we have to add the “Script” Tags to include custom JavaScript files.
Afterwards, we need to add a “Div” Tag with id = “Chrome_ctrl_container” (you can use any unique value as ID) at the top level, as shown highlighted:

Now, if we explore the code in one of the Custom JS files “ChromeLoader.js”, we can see it as:
Step 1: “getParameterByName” is a helper function, that can be utilized to read the query string parameters from the incoming request.
Step 2: Read the “SPHostUrl” query string parameter to get the handle on host Web
Step 3: Load “SP.UI.Controls.js” file in the context of host Web and once loaded, call “renderChrome” method.
Step 4: Inside “renderChrome” method, we are preparing an object holding the Chrome configuration options.
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.








Kuppurasu NagarajPosted Jun 21, 2016, 12:41 PM
Nice Sharing..
Debasis SahaPosted Jun 21, 2016, 12:49 AM
Good One..