Vignesh Subramanian
Vignesh Subramanian

Reputation: 7289

how to add script to html in Microsoft Appstudio

I am trying to add a script inside html in Microsoft Appstudio

But when i refresh and check it is removing the <script>

I checked in their how to page but it didnt help

enter image description here

Upvotes: 1

Views: 120

Answers (1)

Joe Healy
Joe Healy

Reputation: 5817

You can do it, kinda, but its a hack....

First you can't do functions like alert() in the WebView control that app studio uses. Alert is considers a 'secondary window'. Anything that uses a secondary window you cannot use. If you need to use 'alert()' I can develop you a separate hack for that.

Also beware WebView always uses Internet Explorer 11 in document mode. It does not support any ActiveX controls or plugins like Microsoft Silverlight or Portable Document Format (PDF) files. The WebView does not support some HTML5 features including AppCache, IndexedDB, programmatic access to the Clipboard, and geolocation.

On to the hack.

  • Add a html widget to your app studio app online. I just use stub
  • Generate source code from your appstudio app
  • Extract out the source code and open in vs2015 Navigate to /Assets/Data/Html.htm (you may have multiples)
  • Add your scripted and styled source to html.html

Test out your app, but you should be ready to go at this point

Note this is a mod you will have to do EVERY TIME you modify your app in AppStudio. I just keep .htm files outside of my project and drag them in after I generate source code.

If you want to see this process I pushed a video documenting it step by step to https://channel9.msdn.com/Blogs/raw-tech/AppStudio-How-to-Add-script-to-the-HTML-Widget .

If you need more info on the prices to publish AppStudio to Win10 using the source code option, check out https://channel9.msdn.com/Blogs/raw-tech/AppStudio-Publish-to-Windows-10-Store-from-Source-Code .

Not the best route, but definitely do-able. Hope this helps. Healy in Tampa

Upvotes: 2

Related Questions