A while ago I wrote about SharePoint Apps in ASP.NET MVC and how to get them working.
With ShareCoffee 0.1.2
— which is already available on NuGet and bower — you can now ensure that SPHostUrl
is appended to all links in your Apps without making changes to spcontext.js
which is provided by Microsoft.
You can now remove the OOB bundle config and references to spcontext.js
from your Apps and use a single function to extend all links and forms by directly calling
ShareCoffee.Commons.infect();
Compared to Microsoft’s implementation, mine works without referencing jQuery, which means you can also get rid of jQuery if you want to.
The logic itself is still the same. Depending on the current authority and protocol-type the SPHostUrl is appended to the href attribute of links and to all action attributes of form tags.
Book update
Everyone who’s bought my ShareCoffee eBook at leanpub will receive a free book update in the upcoming days. So I’ll describe it there again to ensure completeness.