locked
Using AI in JavaScript Windows Store app RRS feed

  • Question

  • I am trying to use the AI javascript nuget version (ai.0.15.0-build12287.js) in my Windows Store app.

    var appInsights = new Microsoft.ApplicationInsights.AppInsights({ instrumentationKey: "xxxxxxxxx" });

    appInsights.trackEvent("activation");

    But as soon as AI.js tries to send the data buffer using xhr it fails on "xhr.open("POST", this._config.endpointUrl(), true);" with "Access Denied". The ai.js file is bundled with my app and I never had problems using POST requests in Windows Store Apps.

    Any ideas?

    Sample project here: http://1drv.ms/1d0P4MO

    Wednesday, June 17, 2015 12:49 PM

Answers

  • Nevermind. I solved the problem by using the WinRT HTTP client API.

    https://gist.github.com/pke/e866a51bddea93c9f18a

    Now the code printed in my OP works and reports back to Azure.

    • Marked as answer by pkursawe Wednesday, June 17, 2015 7:54 PM
    Wednesday, June 17, 2015 7:54 PM