UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Unable to access local icon images for HTML app with Ionic

    Scheduled Pinned Locked Moved App Development
    3 Posts 2 Posters 457 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • J Offline
        jittopjose
        last edited by

        Hi,
        I am trying to convert an ionic app to a ubports html app. So I copied all the items from ionic build directory (www) to the www directory of ubports app.
        The app launches but the icons are not visible. In the console I got following errors:

        Fetch API cannot load file:///home/jitto/ubports/ionicwebview/build/all/app/install/www/svg/chevron-forward.svg. URL scheme "file" is not supported.
        
        Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/jitto/ubports/testionic/www/svg/business.svg. (Reason: CORS request not http).
        

        I am getting the same error when I tried to run the index.html using chrome in desktop. I guess the browser is blocking local resources.

        Is there any way to override this behaviour while packaging the html app as a ubports app?

        Thanks,
        Jitto

        1 Reply Last reply Reply Quote 0
        • dobeyD Offline
          dobey
          last edited by

          You can try adding --local-content-can-access-remote-urls to the Exec= line in your .desktop file, as an argument to webapp-container.

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jittopjose @dobey
            last edited by

            @dobey It does not seems to be working. I tried following 2 options

            One:

            Exec=webapp-container --allow-file-access-from-files --app-id="testionic.jitto" $@ www/index.html 
            

            Two:

            Exec=webapp-container --local-content-can-access-remote-urls --app-id="testionic.jitto" $@ www/index.html 
            

            Both are not working. Same error ... :anxious_face_with_sweat:

            1 Reply Last reply Reply Quote 0
            • First post
              Last post