PDA

View Full Version : Interactive Map doesn't load in Google Chrome


Pricetx
06-26-2013, 12:07
Hi, I currently run the latest HLX:CE on my HL2:DM server, and the stats page for it can be found here: http://gravitygunonly.com/stats

For some reason, a few months ago the map stopped loading in Google Chrome, but continues to work fine in FireFox and Internet Explorer. I would be tempted to blame chrome for this, but it seems that everybody elses stats page maps work fine!

Does anybody have any ideas as to what might be causing this?

Thanks,

Pricetx

Mr.Spoon
06-26-2013, 13:29
Using the Chrome Element inspector I see the following


[blocked] The page at https://gravitygunonly.com/stats/hlstats.php ran insecure content from http://maps.google.com/maps/api/js?sensor=false. hlstats.php:1 (https://gravitygunonly.com/stats/hlstats.php)
[COLOR=red !important]Uncaught ReferenceError: google is not defined hlstats.php:241 (https://gravitygunonly.com/stats/hlstats.php)

I haven't looked into the hlstats.php yet.

Have you modified this file?

My Hlstats works fine in chrome...

Rytis
06-26-2013, 14:20
Yeah, it looks like, that you or someone else modified your HLStatsX:CE installation

Pricetx
06-26-2013, 16:24
I've narrowed down the problem (a bit at least).

I tried replacing all of the web PHP files (except the settings one) with fresh copies, and this didn't fix it.

I then tried setting nginx to disable SSL and serve everything over plain HTTP, and since I did this, it is now working again.

Does anybody know what might be causing the map to fail to render in chrome when ssl is enabled?

Thanks,

Pricetx

EDIT: Looks like it could be in some way relating to this? http://stackoverflow.com/questions/12216208/chrome-now-blocking-all-jsonp-requests-from-https-to-http

Rytis
06-26-2013, 16:31
Yeah, nginx is not compatible with https connections atm :P

Pricetx
06-26-2013, 16:40
Fixed!

The problem was indeed that the google maps API was trying to work over plain HTTP, which was being blocked by chrome due to security reasons (it doesn't allow remote connections over HTTP if the pages is being served over HTTPS).

the fix was in includes/google_maps.php line 45.

The line originally read:
echo ('<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>');

However, if you change it to:
echo ('<script src="//maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>');

it will use HTTPS if it is available, otherwise falling back to plain HTTP.

Unless anybody sees any downsides to this, it would be good if this changed was merged into HLStatsX, as it would allow others to use it over SSL.

The only issue I can think of is that google_maps.php is an include file, which means that it's probably sourced from upstream somewhere. If it was decided that include files shouldn't be edited then it would at least be useful if an FAQ point was added mentioning "Do I need to configure anything additional to use HTTPS?".

If anybody has any further questions, feel free to let me know.

Thanks,

Pricetx

Rytis
06-26-2013, 16:59
There is also somewhere else a link that begins with http://.., but I forgot in which file :P

sil_El_mot
02-25-2015, 16:33
ah. thank you a lot. i had the same problem and your fix works like a charm!