Reputation:
I have a web application that returns GPS coordinates, sometimes those coordinates get misinterpreted as phone numbers and are then formatted as links by iOS/macOS Safari/mail application. I know that <meta name="format-detection" content="telephone=no">
in the head will disable all phone number from linking, but I just want to do my GPS coordinates. Advice?
Upvotes: 0
Views: 638
Reputation: 6329
The class no-link
works for Apple Mail and data-smartmail="disabled"
or data-detector="disabled"
works for Gmail and other clients. Last resort is splitting numbers with a zero-width non-joiner character like ‌
:
ie.
<span style="white-space: nowrap;" class="no-link" data-smartmail="disable">
101‌604‌733‌4
</span>
or
<span style="white-space: nowrap;" class="no-link" data-smartmail="disable">
john‌@‌hot‌mail‌.‌com
</span>
Upvotes: 0
Reputation: 732
Given that the gps data formated in decimal degrees, and sent as an email as html.
phone number formatting is done by the email client when it detects a phone number and will attempt to have it link to a dialer, or messenger program.
Phone numbers that will get formated
212-389-3934
212.389.3934
(800) 389-3934
1-800-389-3934
(212) 389-3934
212–389–3934
212—389—3934
212–389–3934
212–389–3934
1–212–389–3934
212 -389 -3934
There are two ways to fix the problem with decimal degrees being formatted as phone numbers.
or
<a href=”#” style=”color:#0F3; text-decoration:none”>29.42808 °N -98.48913 °E</a>
Old answer below
! To display gps latitude and longitude, 1st make sure that your html is formatted to be html5 compatible.
next, if that doesn't fix the issue, try the following example,
https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation_watchposition
<!DOCTYPE html>
<html>
<body>
<p>Click the button to get your coordinates.</p>
<button onclick="getLocation()">Try It</button>
<p id="demo"></p>
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.watchPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";}
}
function showPosition(position) {
x.innerHTML="Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
</body>
</html>
The latitude and longitude are separated and labeled.
Upvotes: 0