0

I have an application and it is loaded with https, this application loads a map with a KMZ file, and the content of that file has external reference to a PNG image that is loaded with http. This causes the page's https to break.

Look at this example of how this is done.

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

I want to replace these http references with https before loading external content.

My application uses AngularJS, JQuery and Dojo, the solution can be with any of these technologies.

  • We're a little different from other sites. We're a Q&A site, not a discussion forum. For questions that involve code we ask that you show us where you are stuck with your own code by including a code snippet in your question. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code nicely. Please check out our short tour for more about how the site works. Thanks. – PolyGeo Jan 10 at 5:29
  • Cross-posted as stackoverflow.com/questions/59675809/… – Bjorn Svensson Jan 22 at 18:57
1

How about letting the browser do the work by adding this in the :

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

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

  • thank you, solve the problem – krekto Jan 26 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.