Viewing 1 replies (of 1 total)
  • Thread Starter KerryGee

    (@kerrygee)

    I found a (unsatisfying) solution by my own, which seems to be the easiest and only solution applicable so far (excluding live code/parsing manipulation techniques to change the code in real-time): Change the open street map part from http to https in the OpenStreetMap.js:

    OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
        /**
         * Constructor: OpenLayers.Layer.OSM.Mapnik
         *
         * Parameters:
         * name - {String}
         * options - {Object} Hashtable of extra options to tag onto the layer
         */
        initialize: function(name, options) {
            var url = [
                "https://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
                "https://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
                "https://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
            ];
            options = OpenLayers.Util.extend({
                numZoomLevels: 20,
                attribution: "&copy; <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors; <a href='http://www.HanBlog.Net'>OSM Plugin</a>",
                buffer: 0,
                tileOptions: {crossOriginKeyword: null},
                transitionEffect: "resize"
            }, options);
            var newArguments = [name, url, options];
            OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
        },
    
        CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
    });
    

    Alternatively using a non-protocol variant would very likely automatically select https by default i guess (didnt check!):

            var url = [
                "//a.tile.openstreetmap.org/${z}/${x}/${y}.png",
                "//b.tile.openstreetmap.org/${z}/${x}/${y}.png",
                "//c.tile.openstreetmap.org/${z}/${x}/${y}.png"
            ];
    

    Good news: Easy to implement
    Bad news: Can easily be overwritten with a update/new version

    Any better suggestion is highly appreciated.

    best

    K.

Viewing 1 replies (of 1 total)
  • The topic ‘SSL mixed content warning’ is closed to new replies.