Skip to content

Commit

Permalink
For #152 - replace ampersand with '%26' in URL in case of SMS and in …
Browse files Browse the repository at this point in the history
…case of android 4.4.2
  • Loading branch information
vitalidze committed May 19, 2015
1 parent 3be0edd commit 7d36beb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/webapp/m/js/traccar-mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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));
}
}
];
Expand All @@ -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));
}
}
];
Expand Down

0 comments on commit 7d36beb

Please sign in to comment.