[PATCH] Add support for disabled geolocation
-
Firefox users can disable geolocation completely, so they don’t get pestered with the popup whenever a site tries to use geolocation. Useful for development and desktops. Anyway, here’s a simple patch that makes the map load when geolocation is disabled, feel free to integrate it:
--- wp-content/plugins/wp-google-map-gold/assets/js/vendor/maps/maps.js.orig 2024-08-07 22:07:27.292173804 +0200
+++ wp-content/plugins/wp-google-map-gold/assets/js/vendor/maps/maps.js 2024-08-07 22:19:33.266661744 +0200
@@ -2048,7 +2048,7 @@
get_user_position: function () {
var map_obj = this;
-
+ if (typeof navigator.geolocation == 'undefined') return;
navigator.geolocation.getCurrentPosition(function (position) {
map_obj.user_lat_lng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
@@ -6020,6 +6020,11 @@
var map = this;
+ if (typeof navigator.geolocation == 'undefined') {
+ if (error_func)
+ error_func({});
+ return;
+ }
if (typeof map.user_location == 'undefined') {
navigator.geolocation.getCurrentPosition(function (position) {
--- wp-content/plugins/wp-google-map-gold/wp-google-map-gold.php.orig 2024-08-07 22:11:08.681542525 +0200
+++ wp-content/plugins/wp-google-map-gold/wp-google-map-gold.php 2024-08-07 22:12:42.157120402 +0200
@@ -617,7 +617,7 @@
});
$(".wpgmp_mcurrent_loction").click(function() {
-
+ if (typeof navigator.geolocation == 'undefined') return;
navigator.geolocation.getCurrentPosition(function(position) {
var position = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.