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

How to replace http for https before DOM Construct on load KMZ file with ArcGIS API JS

我有一个应用程序,它使用 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

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

我的应用程序使用 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