首页 > 解决方案 > 我的 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();


        },     

                                         },

标签: flutterflutter-webstellar

解决方案


推荐阅读