【发布时间】:2025-11-30 00:50:01
【问题描述】:
我决定使用 Dart 来开发一个 webApp 来学习它并希望看到它传播开来。我今天面临的问题如下:
我使用 HttpRequest 发出跨域请求,由于 api 没有发送“Access-Control-Allow-Origin”标头,我最终得到一个错误:
XMLHttpRequest cannot load https://api.eveonline.com/account/APIKeyInfo.xml.aspx?keyID=vide&vCode=vide&. No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://127.0.0.1:3030' is therefore not allowed access.
Instance of '_XMLHttpRequestProgressEvent@0x3918afae'
我发现了一些与该问题有关的问题,但没有真正的解决方案。我不想使用服务器端应用程序作为代理。我读到 jquery 有一个解决方案,它允许跨域请求在响应中没有“Control-Allow-Origin”,但如果可能的话,我宁愿不使用 jquery。
如果你们中的任何人有解决方案或线索可以找到一个很棒的解决方案!
编辑:我最终在 php 中构建了一个小型代理,即使我更喜欢更“dartian”的解决方案。谢谢你的答案。
【问题讨论】:
标签: cross-domain dart