Loading local content through XHR in a Chrome packaged app

后端 未结 3 1067
清歌不尽
清歌不尽 2021-01-01 04:11

I\'m trying to load in a web app that I\'ve built using Backbone and it pulls in JSON and HTML template files that are stored locally. I was wondering with Chrome packaged a

3条回答
  •  旧时难觅i
    2021-01-01 04:49

    You are making a request from a sandboxed page, and sandboxed pages have a null origin.

    I have posted this issue question on the Google Group.

    Unless Chrome decides to changed the sandbox policy, it appears the only workaround is to make XHR requests from a non-sandboxed page and use Chrome's message passing API to give it to your sandboxed page.

    I don't know why it has to be so difficult.

    EDIT:

    The answer from the Chrome Team was to change the CORS header to *.

提交回复
热议问题