D3 + Angular 4 + chrome无法从本地IP读取JSON文件

问题描述 投票:0回答:1

Angular 4应用程序托管在https://192.168.1.104:xxxx上,并通过提供基本身份验证凭据进行访问。

以下代码片段用于读取美国各州边界坐标的JSON文件,并使用D3绘制它们。

D3.json("/assets/topojson/us.json", function (error, us: any) {
            self.mapUSGroup.append("path")
                .attr("class", "state")
                .datum(Topojson.feature(us, us.objects.states))
                .attr("d", self.projectionPath);
        });

它在Firefox上使用时读取文件但在Chrome上它会出现以下控制台错误并再次请求身份验证。

GET https://null:[email protected]:20043/assets/topojson/us.json 401 (Unauthorized)

它在Angular 2上工作正常。它适用于外部IP。

我错过了什么吗?

angular google-chrome d3.js
1个回答
1
投票

它似乎与"HTTP Basic Authentication credentials in Google Chrome 64 not transfered to AJAX calls in d3.js"有关

哪个州

从谷歌Chrome 64开始,它在URL中处理基本身份验证凭据方面有一些变化。

© www.soinside.com 2019 - 2024. All rights reserved.