From 7d36beb20afd26da09f16afeb814d4d1b83ac46b Mon Sep 17 00:00:00 2001 From: Vitaly Litvak Date: Wed, 20 May 2015 01:32:02 +0300 Subject: [PATCH] For #152 - replace ampersand with '%26' in URL in case of SMS and in case of android 4.4.2 --- src/main/webapp/m/js/traccar-mobile.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/m/js/traccar-mobile.js b/src/main/webapp/m/js/traccar-mobile.js index acfe12f5..2579c2e5 100644 --- a/src/main/webapp/m/js/traccar-mobile.js +++ b/src/main/webapp/m/js/traccar-mobile.js @@ -529,9 +529,13 @@ function drawDeviceDetails(deviceId, position) { } return text; }; - var drawURL = function() { + var drawURL = function(sms) { var p = appState.latestPositions[deviceId]; - return 'http://www.openstreetmap.org/?mlat=' + p.latitude + '%26mlon=' + p.longitude; + var amp = '&'; + if (sms || myApp.device.android && myApp.device.osVersion == '4.4.2') { + amp = '%26'; + } + return 'http://www.openstreetmap.org/?mlat=' + p.latitude + amp + 'mlon=' + p.longitude; }; // register 'send by email' function @@ -547,7 +551,7 @@ function drawDeviceDetails(deviceId, position) { { text: i18n.send_location_url_by_email, onClick: function () { - window.location = 'mailto:?subject=' + encodeURIComponent(drawSubject()) + '&body=' + encodeURIComponent(drawURL()); + window.location = 'mailto:?subject=' + encodeURIComponent(drawSubject()) + '&body=' + encodeURIComponent(drawURL(false)); } } ]; @@ -567,7 +571,7 @@ function drawDeviceDetails(deviceId, position) { { text: i18n.send_location_url_by_sms, onClick: function () { - window.location = 'sms:?body=' + encodeURIComponent(drawURL()); + window.location = 'sms:?body=' + encodeURIComponent(drawURL(true)); } } ];