“Origin null is not allowed by Access-Control-Allow-Origin” error for request made by application running from a file:// URL

后端 未结 17 1480
孤城傲影
孤城傲影 2020-11-21 04:42

I\'m developing a page that pulls images from Flickr and Panoramio via jQuery\'s AJAX support.

The Flickr side is working fine, but when I try to $.get(url, ca

17条回答
  •  南方客
    南方客 (楼主)
    2020-11-21 05:21

    There is a small problem in the solution posted by CodeGroover above , where if you change a file, you'll have to restart the server to actually use the updated file (at least, in my case).

    So searching a bit, I found this one To use:

    sudo npm -g install simple-http-server # to install
    nserver # to use
    

    And then it will serve at http://localhost:8000.

提交回复
热议问题