搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

Unblock CORS for specific website?

  • 無回覆
  • 0 有這個問題
  • 3 次檢視
more options

I was trying to develop an android app with Cordova, and test it locally in my browser. But, the browser won't allow me to fetch() from an external site, even though this behavior would be allowed if the same code runs as a native app. For development and testing purposes, is there a way to temporarily unblock CORS for a specific site?

I'd also love if this were something that were a standard permissions setting, just like you can grant access to the camera or to your location. Then we could make third-party clients for other popular sites without needing workarounds like a browser extension or a proxy server. Maybe there could be a warning like "app.com tried to fetch from example.com, but that site does not allow cross-origin resource sharing. fetch anyway?"

But honestly I'd just be happy with a way to unblock CORS for a single tab for development purposes. Is this already possible? If not, are there some other good ways to test a webview app?

I was trying to develop an android app with [https://cordova.apache.org/ Cordova], and test it locally in my browser. But, the browser won't allow me to fetch() from an external site, even though this behavior would be allowed if the same code runs as a native app. For development and testing purposes, is there a way to temporarily unblock CORS for a specific site? I'd also love if this were something that were a standard permissions setting, just like you can grant access to the camera or to your location. Then we could make third-party clients for other popular sites without needing workarounds like a browser extension or a proxy server. Maybe there could be a warning like "app.com tried to fetch from example.com, but that site does not allow cross-origin resource sharing. fetch anyway?" But honestly I'd just be happy with a way to unblock CORS for a single tab for development purposes. Is this already possible? If not, are there some other good ways to test a webview app?

如果您還沒有帳號,您必須先登入帳號 來回覆文章。還沒有帳號的話,只能發問新問題