搜尋 Mozilla 技術支援網站

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

Learn More

Access-Control-Allow-Origin

  • 無回覆
  • 0 有這個問題
  • 32 次檢視
  • 最近回覆由 ahtisham ali

more options

Hello everyone,

I'm currently consuming APIs hosted on an external server using Java( or any other server side language), and everything works smoothly. However, when attempting to consume the same APIs in JavaScript, I encounter the 'Access-Control-Allow-Origin' error.

After some research, I discovered that browsers implement security checks leading to this issue. Can anyone advise on how to disable these security checks or resolve this issue when accessing the website in the Firefox browser? Any insights would be greatly appreciated. Thanks in advance!

Hello everyone, I'm currently consuming APIs hosted on an external server using Java( or any other server side language), and everything works smoothly. However, when attempting to consume the same APIs in JavaScript, I encounter the ''''Access-Control-Allow-Origin'''' error. After some research, I discovered that browsers implement security checks leading to this issue. Can anyone advise on how to disable these security checks or resolve this issue when accessing the [https://lescobilling.pk/lesco-bill-calculator/ website] in the Firefox browser? Any insights would be greatly appreciated. Thanks in advance!

由 Ahtisham Ali 於 修改

所有回覆 (1)

more options

Issue: Browsers implement security checks, such as verifying the CORS headers in the server response, to ensure the requested domain is allowed. If the server is on a different domain, the browser checks if the requesting domain is whitelisted in the CORS headers. For example, if you're sending a request from the domain 'https://fescobilling.pk/xyz' to a server hosted on 'https://pescobilling.pk/abc', the browser will verify that the xyz server has whitelisted the abc domain or IP.

Solution: To resolve this issue, you'll need to request the server's technical team to whitelist your domain. Alternatively, you can consume the APIs from a server-side language instead.

有幫助嗎?

問個問題

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