none
Which script references are best for deployment? RRS feed

  • Question

  • In the starting HTML for apps for Office, it makes clear that it's best to use the CDN reference for Office.js. That description is here:

      <!-- Use the CDN reference to Office.js when deploying your app -->
      <!--<script src="https://appsforoffice.microsoft.com/lib/1.0/hosted/office.js"></script>-->
    
      <!-- Use the local script references for Office.js to enable offline debugging -->
      <script src="../Scripts/Office/1.0/MicrosoftAjax.js"></script>
      <script src="../Scripts/Office/1.0/Office.js"></script>

    What does that imply for the other scripts? How about Ajax and Jquery? Do they keep the local references for deployment or should they be CDN references as well? If the latter, what references should be added?

    Best wishes and thanks in advance,

    Daniel

    Wednesday, February 27, 2013 12:57 PM

Answers

  • The benefits of Content Delivery Networks are twofold:

    1 - The CDN can potentially serve the files to your user faster, as it may be located physically closer to the user than your server, and reuse by different web sites can mean the script is already cached before the user loads your app.

    2 - You save on your own server's bandwidth, reducing your costs.

    There are other advantages too, such as an increased trust that you've got a "good" copy of the script, minimized releases, the ability to easily swap out versions, debug builds, https, etc.

    There are several CDNs out there you can choose for popular scripts. Microsoft maintains one that has worked well for me. You'll find it documented here:

    http://www.asp.net/ajaxlibrary/cdn.ashx

    You'll find JQuery, Ajax, Knockout, and a host of other scripts up there.

    As for maintaining a local copy of a script, that's always an option. The Microsoft CDN above shows code that uses the CDN and also falls back on a local copy.

    • Marked as answer by DanielHeuman Wednesday, February 27, 2013 2:54 PM
    Wednesday, February 27, 2013 2:43 PM

All replies

  • The benefits of Content Delivery Networks are twofold:

    1 - The CDN can potentially serve the files to your user faster, as it may be located physically closer to the user than your server, and reuse by different web sites can mean the script is already cached before the user loads your app.

    2 - You save on your own server's bandwidth, reducing your costs.

    There are other advantages too, such as an increased trust that you've got a "good" copy of the script, minimized releases, the ability to easily swap out versions, debug builds, https, etc.

    There are several CDNs out there you can choose for popular scripts. Microsoft maintains one that has worked well for me. You'll find it documented here:

    http://www.asp.net/ajaxlibrary/cdn.ashx

    You'll find JQuery, Ajax, Knockout, and a host of other scripts up there.

    As for maintaining a local copy of a script, that's always an option. The Microsoft CDN above shows code that uses the CDN and also falls back on a local copy.

    • Marked as answer by DanielHeuman Wednesday, February 27, 2013 2:54 PM
    Wednesday, February 27, 2013 2:43 PM
  • Note that for apps submitted to the Office store, we also *require* that you reference the CDN.
    Wednesday, March 6, 2013 1:31 AM
  • another benefit of using the CDN is that you will automatically get any important updates (such as security fixes or performance  updates ) .
    Wednesday, March 6, 2013 11:09 AM
    Moderator
  • Andrew,

    That's just for the Office.js file right? Or does it extend to other popular libraries hosted on a Microsoft CDN?

    Steve

    Wednesday, March 6, 2013 11:05 PM