Anticipating a future, I am experimenting with User Custom Actions in the new Document Library View Microsoft has so kindly provided to the First Release Office365 tenants.

Since there is almost nothing SharePoint left (no JSOM, no SOD) I am trying new technologies to get JS library dependencies working.
Note that Microsoft does load RequireJS, but if they can get rid of the SP Object, JSOM etc.
I am not going to rely on anything but a modern Browser

fetch is Chrome and Firefox only for now (april 2016) http://caniuse.com/#feat=fetch

    .then(function (q) {
        return q.text();
    .then(eval) //for those who think evil! It does the same as the (old) DOM abusing below
        //do stuff

Since this is all Promises, this would make loading multiple libraries a breeze

Any cons in using this over:
(good old abusing the DOM for no reason other then get a file loaded/executed):

var element = document.createElement("script");
element.src = "https://.../file.js";
element.load = function(){
    //do stuff
  • Wouldn't fetch be restricted by Same Origin Policy? And thinking about future, isn't eval (by default) disallowed in Content Security Policy?
    – eirikb
    May 1, 2016 at 18:53
  • Thats up to Microsoft. I have no idea how difficult it would be for them to implement.. but SharePoint is a 15 year old beast, I can image it would take some serious regression testing. In that aspect getting rid of all the (old) SharePoint shit in the new Document Library makes sense to me now. html5rocks.com/en/tutorials/security/content-security-policy May 2, 2016 at 9:04
  • Judging by the handfull of times eval is used in the new Library View CoreMinShellG2BundleA library; Microsoft has no intention yet to go CSP May 2, 2016 at 15:04


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.