XDomainRequest errors, blind troubleshooting

OK, so I’m working with code but have no test environment set up yet nor ability to push to production, so I’m blind troubleshooting. In IE10, and IE9 confirmed so far, a Google Maps location service script on one of our pages doesn’t work (Console “Error: Access Denied”). From my research, I think the problem I’m having is related to the fact that, inside the conditional that’s grabbing IE clients, the var url is set to http rather than https. That’s a problem (I think), as it’s pulling non-SSL content into an SSL secured domain (the current site).

So, my question is, can anyone looking at this who knows JS/JSON/etc far better than I think of a reason why they would’ve intentionally used a non https URL there, or could it simply be a typo? And does my thought process above sound legitimate? I’m going for solving it as well as I can on paper so to speak, so that when I get my access figured out later this week I can hop right on it.

jQuery('#views-exposed-form-locations-page-1').submit(function(event) {
			event.preventDefault();
			s = jQuery("#views-exposed-form-locations-page-1 #edit-location").val();
			s = s.replace(/\s+/g, ' ');
			var $lookup_address = encodeURIComponent(s);
			var url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + $lookup_address + "&sensor=false";
			
			// Handle IE8/IE9 differently:
			if (window.XDomainRequest) {
				var url = "http://maps.googleapis.com/maps/api/geocode/json?address=" + $lookup_address + "&sensor=false";
				var xdr = new XDomainRequest();
				xdr.onload = function() {
					var data = JSON.parse(xdr.responseText);
					if (data.status == 'OK') {
						lat_lng = data.results[0].geometry.location.lat + ',' + data.results[0].geometry.location.lng;
						jQuery("#views-exposed-form-locations-page-1 #set_lat").val(data.results[0].geometry.location.lat);
						jQuery("#views-exposed-form-locations-page-1 #set_lng").val(data.results[0].geometry.location.lng);
						jQuery('#views-exposed-form-locations-page-1').unbind('submit').submit();
					}
				};
				xdr.open("POST", url);
				xdr.send();
			} else {
				jQuery.getJSON(url, function(data) {
					if (data.status == 'OK') {
						lat_lng = data.results[0].geometry.location.lat + ',' + data.results[0].geometry.location.lng;
						jQuery("#views-exposed-form-locations-page-1 #set_lat").val(data.results[0].geometry.location.lat);
						jQuery("#views-exposed-form-locations-page-1 #set_lng").val(data.results[0].geometry.location.lng);
						jQuery('#views-exposed-form-locations-page-1').unbind('submit').submit();
					}
				});
			}
		});

Maybe you’ll find something helpful here?

https://meta.discourse.org/t/can-google-maps-be-embedded-into-topics/11146?u=mittineague

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.