Search code examples
windows-phone-8.1winjswin-universal-app

Remote URL (http) as icon for AppBarCommand in WinJS Universal App


First off, this is a Universal App and this specifically is happening when it is run on a Windows Phone.

I am creating an AppBarCommand in my app via JavaScript. Here is the code:

var commandElement = document.createElement('button');
var command = new WinJS.UI.AppBarCommand(commandElement, {
    id: [id],
    label: [text],
    onclick: function () {  }
});

If I try to set the 'icon' property with a remote URL (http://) it does not work. Is this not possible on Windows Phone?


Solution

  • I had some code like yours in a Win 8.1 app that did not work at all when I used the same code in WinPhone 8.1 app.

    I had to change my code declare the AppBar in my html with every possible command and show or hide commands depending on that page needs.