I want to include a web hosted piece of javascript to act as a widget in my metro application. The goal would be to be able to maintain the state of the widget outside of the metro app so that a change to the widget code wouldn’t require a repackaging and publishing to the app store.
e.g. (in my html file in the metro app)
<script type="text/javascript" src="https://link.to.website/widget.js">
It’s important to understand the differences between the local and web context. Particular restrictions are documented here: http://msdn.microsoft.com/en-us/library/windows/apps/hh465373.aspx — what is worth noting is that you can only include external script files from pages running in the web context.
Also, your app always has to have a top level page that is in your package. This page must be in the local context and loaded via the ms-appx scheme. This outer page may choose to iframe pages loaded in the web context (via ms-appx-web for in-package files or via http/https for pages hosted on the web.)
What you should keep in mind is that even though you can load external script into a web context page, that script cannot access the Windows Runtime APIs. If you want your external script to be able to call WinRT, you can create a communication channel using the HTML5 Web Messaging APIs.