如何在使用 ArcGIS API JS 加载 KMZ 文件时在 DOM 构造之前将 http 替换为 https



我有一个应用程序,它加载了https,这个应用程序加载了一个带有KMZ文件的地图,该文件的内容对加载http的PNG图像有外部引用。这会导致页面的 https 中断。

看看这个例子是如何完成的。

var kmlUrl = "https://s3.amazonaws.com/geodera-bucket/filesds/5c2e82457cd9e62b0a453ce3-1578081436616-bushfireAlert.kmz";
var kml = new KMLLayer(kmlUrl);
map.addLayer(kml);
kml.on("load", function() {
domStyle.set("loading", "display", "none");
});

https://codepen.io/krekto/pen/NWPYmRb

我想在加载外部内容之前将这些 http 引用替换为 https。

我的应用程序使用AngularJS,JQuery和Dojo,解决方案可以使用这些技术中的任何一种。

(在 https://gis.stackexchange.com/questions/347046/how-to-replace-http-for-https-before-dom-construct-on-load-kmz-file-with-arcgis 重复的问题中回答(

如何让浏览器通过在头部添加以下内容来完成工作:

<meta http-equiv="Content-Security-Policy" 
content="upgrade-insecure-requests">

见 https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests

最新更新