Solved! Go to Solution.
//add setRequest esri.setRequestPreCallback(myCallbackFunction); function myCallbackFunction(ioArgs) { console.log(ioArgs.url); //check to make sure the url is going to Microsoft if (ioArgs.url.indexOf("virtualearth") > -1) { //if so, add a new parameter called uriScheme and set the value equal to 'https' ioArgs.content.uriScheme = "https"; // don't forget to return ioArgs. } return ioArgs; }
<!DOCTYPE html> <html> <head> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <title>VE Tile Layer</title> <link rel="stylesheet" href="https://js.arcgis.com/3.2/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.2/js/esri/css/esri.css"> <script>dojoConfig = { parseOnLoad: true }</script> <script src="https://js.arcgis.com/3.2/"></script> <script> dojo.require("esri.map"); dojo.require("esri.virtualearth.VETiledLayer"); dojo.require("dijit.form.Button"); var veTileLayer; function init() { var map = new esri.Map("map"); //add setRequest esri.setRequestPreCallback(myCallbackFunction); //Creates the Virtual Earth layer to add to the map veTileLayer = new esri.virtualearth.VETiledLayer({ bingMapsKey: 'Your Bing Map Key goes here', mapStyle: esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL }); function myCallbackFunction(ioArgs) { console.log(ioArgs.url); //check to make sure the url is going to Microsoft if (ioArgs.url.indexOf("virtualearth") > -1) { //if so, add a new parameter called uriScheme and set the value equal to 'https' ioArgs.content.uriScheme = "https"; // don't forget to return ioArgs. } return ioArgs; } map.addLayer(veTileLayer); } dojo.ready(init); </script> </head> <body class="claro"> <div style="position: relative;"> <div id="map" style="width: 1024px; height: 512px; border: 1px solid #000;"> <div style="position: absolute; left: 650px; top: 10px; z-Index: 999;"> <button data-dojo-type="dijit.form.Button" onclick="veTileLayer.setMapStyle(esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL);">Aerial</button> <button data-dojo-type="dijit.form.Button" onclick="veTileLayer.setMapStyle(esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL_WITH_LABELS)">Aerial with labels</button> <button data-dojo-type="dijit.form.Button" onclick="veTileLayer.setMapStyle(esri.virtualearth.VETiledLayer.MAP_STYLE_ROAD)">Roads</button> </div> </div> </div> </body> </html>
//add setRequest esri.setRequestPreCallback(myCallbackFunction); function myCallbackFunction(ioArgs) { console.log(ioArgs.url); //check to make sure the url is going to Microsoft if (ioArgs.url.indexOf("virtualearth") > -1) { //if so, add a new parameter called uriScheme and set the value equal to 'https' ioArgs.content.uriScheme = "https"; // don't forget to return ioArgs. } return ioArgs; }
<!DOCTYPE html> <html> <head> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <title>VE Tile Layer</title> <link rel="stylesheet" href="https://js.arcgis.com/3.2/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.2/js/esri/css/esri.css"> <script>dojoConfig = { parseOnLoad: true }</script> <script src="https://js.arcgis.com/3.2/"></script> <script> dojo.require("esri.map"); dojo.require("esri.virtualearth.VETiledLayer"); dojo.require("dijit.form.Button"); var veTileLayer; function init() { var map = new esri.Map("map"); //add setRequest esri.setRequestPreCallback(myCallbackFunction); //Creates the Virtual Earth layer to add to the map veTileLayer = new esri.virtualearth.VETiledLayer({ bingMapsKey: 'Your Bing Map Key goes here', mapStyle: esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL }); function myCallbackFunction(ioArgs) { console.log(ioArgs.url); //check to make sure the url is going to Microsoft if (ioArgs.url.indexOf("virtualearth") > -1) { //if so, add a new parameter called uriScheme and set the value equal to 'https' ioArgs.content.uriScheme = "https"; // don't forget to return ioArgs. } return ioArgs; } map.addLayer(veTileLayer); } dojo.ready(init); </script> </head> <body class="claro"> <div style="position: relative;"> <div id="map" style="width: 1024px; height: 512px; border: 1px solid #000;"> <div style="position: absolute; left: 650px; top: 10px; z-Index: 999;"> <button data-dojo-type="dijit.form.Button" onclick="veTileLayer.setMapStyle(esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL);">Aerial</button> <button data-dojo-type="dijit.form.Button" onclick="veTileLayer.setMapStyle(esri.virtualearth.VETiledLayer.MAP_STYLE_AERIAL_WITH_LABELS)">Aerial with labels</button> <button data-dojo-type="dijit.form.Button" onclick="veTileLayer.setMapStyle(esri.virtualearth.VETiledLayer.MAP_STYLE_ROAD)">Roads</button> </div> </div> </div> </body> </html>