flutter - 我的 Flutter Web 应用程序中的 CORS 策略阻止了对 XMLHttpRequest 的访问
问题描述
我正在使用 Stellar 网络颤振 Sdk,我正在尝试从“https://soneso.com/.well-known/stellar.toml”的域中加载一个 toml 文件
但我不断收到此错误“从源 'http://localhost:55821' 访问 'https://soneso.com/.well-known/stellar.toml' 的 XMLHttpRequest 已被 CORS 策略阻止:对预检的响应请求未通过访问控制检查:请求的资源上不存在“Access-Control-Allow-Origin”标头”
这是我下面的代码
InkWell(
onTap:
() {
check() async {
stellar.StellarToml stellarToml = await stellar.StellarToml.fromDomain("soneso.com");
stellar.GeneralInformation generalInformation = stellarToml.generalInformation;
print(generalInformation);
}
html.window.open("https://www.w3schools.com", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=${MediaQuery.of(context).size.height * 40 / 100},left=,width=400,height=700");
check();
},
},
解决方案
推荐阅读
- spring-boot - Websocket:意外的响应代码:302
- ios - 在 Storyboard 中的视图之间切换
- snowflake-cloud-data-platform - 为什么雪花 LAST_QUERY_ID 返回 NULL?
- java - 在春季使用 mongodb 聚合展平嵌套数组
- angular - 如何将外部变量传递给 ngx-datatable-column?
- windows - 在 Powershell IDE 中执行 CMD 命令让 shell 空闲
- ios - 将现有的免费应用程序转换为 Inapppurchase
- javascript - 使用 HybridView、Xamarin 跨平台在外部 url 上执行 Javascript
- javascript - React Native如何修复底部的东西
- kubernetes - Minikube 暴露服务 url,获取连接被拒绝