Search code examples
windows-8windows-10toast

May I embed images as data URI with Windows 8/10 toast notifications?


I'm trying to write an application that offers toast notifications on Windows 8 and newer.

Is it possible instead of referencing an image file on the local disk to use data URIs in order to display an image via the XML that one passes to show the toast? I was unable to come up with any documentation so far and I am still in the research phase for my project (so no code to "simply" try, yet).


Solution

  • No. DataUris are not supported for images in toasts (or tiles)

    Update/documentation/proof:

    For 8
    From https://msdn.microsoft.com/en-us/library/windows/apps/hh761494.aspx

    In this set of templates, the image element is expressed using one of these protocols:
    •http:// or https:// A web-based image.
    •ms-appx:/// An image included in the app package.
    •ms-appdata:///local/ An image saved to local storage.
    •file:/// A local image. (Only supported for desktop apps.)

    And for 10
    From https://msdn.microsoft.com/en-us/library/windows/apps/br230844.aspx

    The URI of the image source, using one of these protocol handlers:
    •http:// or https:// A web-based image.
    •ms-appx:/// An image included in the app package.
    •ms-appdata:///local/ An image saved to local storage.
    •file:/// A local image. (Supported only for desktop apps. This protocol cannot be used by Windows Store apps.)

    Bonus, on WP 8.X you couldn't even specify the image, it just used the app icon.