locked
Trying do download remote WOFF and load it locally RRS feed

  • Question


  • I been trying to load remote resources, specially font files, and since it seems it is not possible (unless using iframes), I am trying the download way.

    I have sucessfuly downloaded the font with

    Windows.Storage.ApplicationData.current.localFolder.createFileAsync() from the blob sample example (using local folder instead of picture library) and the font does get saved in

    C:\Users\ola\AppData\Local\Packages\9159f07e-8e99-4252-8df5-2b4e699a6022_wm1g3fgavn9z4\LocalState\font.woff

    Now my problem is that I need to invoke my resource in my css.

    I am using:

    @font-face {font-family:'20db';src: url('"+URL.createObjectURL(file, false)+"') format('woff');font-weight: normal;font-style: normal;}body{background:yellow;}p{font-family:'20db';}

    The blob temporary link is created, but the app throws again the "cannot load remote web resources" error.

    I really need to invoke this font into my app. The file is already local. What am I missing?

    Thanks.

    Error:WWA9601: Cannot load <blob:649E167272CA>. An application cannot load remote web content in the local compartment.
    File: ms-wwa://9159f07e-8e99-4252-8df5-2b4e699a6022-wm1g3fgavn9z4/default.html


    "The more difficult something became, the more rewardant it was in the end"
    http://ftduarte.blogspot.com




    Monday, February 20, 2012 3:38 PM

Answers

All replies

  • Hi Ft,

    I assume you are using a properly licensed WOFF file in your application.  If that is the case, simply download the WOFF file and make it part of your application.  In my case I created a folder called 'fonts' and then chose 'add existing item' to add my WOFF file as part of the deployed package.  Then in my CSS file just simply include it for that style:

            @font-face
            {
                font-family: Whimsy;
                src: url('ms-wwa:///fonts/Whimsy.woff');
            }
            

    If you are not using a properly licensed WOFF file, please do not do this.

    -Jeff


    Jeff Sanders (MSFT)

    Monday, February 20, 2012 9:01 PM
    Moderator
  • I know but that's not what I want.

    Sure it would work, but my application scenario requires the font to be dynamically downloaded somehow.

    I need to download the font, which already works, but then I need an URL that will load it, without it being inside the app project. Maybe the temp folder, doc lib or localFolder.


    "The more difficult something became, the more rewardant it was in the end"
    http://ftduarte.blogspot.com


    • Edited by ftduarte Wednesday, February 22, 2012 9:54 AM
    Monday, February 20, 2012 9:05 PM
  • I'm doing the exact same thing the blob sample does, only I'm not using an image file type.

    "The more difficult something became, the more rewardant it was in the end"
    http://ftduarte.blogspot.com

    Wednesday, February 22, 2012 10:51 AM
  • This is a know issue and the product team is aware of this.

    Jeff Sanders (MSFT)


    Thursday, February 23, 2012 8:43 PM
    Moderator
  • Jeff,

    Is there any update on this issue?

    I'm using Windows 8 RTM and I'm unable to load woff files from blog derived from local storage file.

    Unfortunately, embedding the font in the app will not work for me either.

    Sunday, September 9, 2012 6:53 AM
  • Hi Ghost,

    No, no changes in this area.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, September 25, 2012 2:35 PM
    Moderator