locked
Persistant broken image error

    Question

  • I am persistently getting broken image icons when testing my app using VS 2012.

    Here is an example of the code:

            var pic19 = "/pages\itemDetail\jwst19.jpg";
    

    I checked that all the directories were correct and that the variables were being called correctly.  Any ideas why this problem won't go away?
    Thursday, December 27, 2012 7:38 PM

Answers

  • Did you try with:
    var pic19 = "/pages/itemDetail/jwst19.jpg";

    Maybe the \ that you have in your example are being taken as escape characters instead of part of the path.
    • Proposed as answer by tt92618 Friday, December 28, 2012 6:15 AM
    • Marked as answer by 5D Concepts Wednesday, May 29, 2013 4:32 AM
    Thursday, December 27, 2012 7:56 PM
  • Hi,

    Please define the url as follow:

    ms-appx:///images/g.jpg


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Tuesday, January 8, 2013 3:42 AM
    Wednesday, January 2, 2013 2:57 AM
  • Hi 5D Concepts,

    AS for the icon image, how did you load it and display in the app? Have you tried directly using <img src="/page/itemDetails/jwst19.jpg" /> in html template to see if it works?

    In Windows Store HTML+Javascript app, there are several means through which we can load file based resources:

    • You can use relative path (if the resource file is in the same folder or sub folder of the html page)
    • You can use absolute path from the project root such as "/images/testimage.png"
    • You can also use "application package" specific absolute path (also from the project root) like: "ms-appx:///images/testimage.png"

    for more information, you can refer to the following MSDN document:


    #How to load file resources (Windows Store apps using JavaScript and HTML) (Windows)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh781229.aspx


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Tuesday, January 8, 2013 3:42 AM
    Wednesday, January 2, 2013 3:26 AM
    Moderator

All replies

  • Did you try with:
    var pic19 = "/pages/itemDetail/jwst19.jpg";

    Maybe the \ that you have in your example are being taken as escape characters instead of part of the path.
    • Proposed as answer by tt92618 Friday, December 28, 2012 6:15 AM
    • Marked as answer by 5D Concepts Wednesday, May 29, 2013 4:32 AM
    Thursday, December 27, 2012 7:56 PM
  • I tried that but unfortunately it still doesn't work.
    Sunday, December 30, 2012 7:18 PM
  • Hi,

    Please define the url as follow:

    ms-appx:///images/g.jpg


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Tuesday, January 8, 2013 3:42 AM
    Wednesday, January 2, 2013 2:57 AM
  • Hi 5D Concepts,

    AS for the icon image, how did you load it and display in the app? Have you tried directly using <img src="/page/itemDetails/jwst19.jpg" /> in html template to see if it works?

    In Windows Store HTML+Javascript app, there are several means through which we can load file based resources:

    • You can use relative path (if the resource file is in the same folder or sub folder of the html page)
    • You can use absolute path from the project root such as "/images/testimage.png"
    • You can also use "application package" specific absolute path (also from the project root) like: "ms-appx:///images/testimage.png"

    for more information, you can refer to the following MSDN document:


    #How to load file resources (Windows Store apps using JavaScript and HTML) (Windows)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh781229.aspx


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Tuesday, January 8, 2013 3:42 AM
    Wednesday, January 2, 2013 3:26 AM
    Moderator