Couldn't ajax local file from local html page

前端 未结 2 471
逝去的感伤
逝去的感伤 2020-12-07 06:26

According to Same Origin Policy, SOP shouldn\'t apply to file:// protocol, but why my code does not work? I am running this testing page from my local system and I have abc.

2条回答
  •  春和景丽
    2020-12-07 06:56

    This is not a bug, it's a security feature which you can't/won't get around on a client's computer.

    In chrome you can disable it by adding the following flag on the command line

    --disable-web-security

    Firefox might have something similar but I don't know it. This is only useful for development purposes and you can't rely on this behaviour in your application.

    You should really just use a server ...

提交回复
热议问题