为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Is there a way to ignore Cross-Origin Request Blocked?

more options

Hi, I am learning web development. I am into AJAX now. When I try to use `load('ajax/somedata.txt')` in a local HTML file, I get the error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/sourav/The%20Complete%20Web%20Development%20Course/JQuery/ajax/somedata.txt. (Reason: CORS request not http).

Same happens with other browsers. But Falkon browser is an exception. The other way to fix this is running an http server (like WEBrick).

Just because Firefox is my favourite browser, I want to load up the file correctly in Firefox. Is there a way to do that without running a local HTTP server?

Hi, I am learning web development. I am into AJAX now. When I try to use `load('ajax/somedata.txt')` in a local HTML file, I get the error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/sourav/The%20Complete%20Web%20Development%20Course/JQuery/ajax/somedata.txt. (Reason: CORS request not http). Same happens with other browsers. But Falkon browser is an exception. The other way to fix this is running an http server (like WEBrick). Just because Firefox is my favourite browser, I want to load up the file correctly in Firefox. Is there a way to do that without running a local HTTP server?

由Sourav于修改

所有回复 (2)

more options

This link might have information for you.

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp

There might not be a workaround.

more options

Rich B said

This link might have information for you. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp There might not be a workaround.

Actually, the article mentions the preference you can use to roll back the patch, but to use that, you may need to know the steps to change a preference.

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful or accepting the risk.

(2) In the search box above the list, type or paste uniq and pause while the list is filtered

(3) Double-click the privacy.file_unique_origin preference to switch the value from true to false

To mitigate the vulnerability this patch addressed:

Save pages from untrusted sites in a completely separate folder, e.g., Downloads\Untrusted. That would make it difficult for an attacker to find any valuable content using local file links.