Jump to content

GPS location in movile or desktop


asapltda

Recommended Posts

Good morning,

I run the following code to get the GPS location: 1

. If the form is made with unigui movile on the desktop it shows the data of the gps position on the screen, but it does not work on the mobile

2.if I do it in the form of a desktop it works on the desktop BUT it doesn't work on the mobile. I could see if the desktop code is different than the mobile code or if it's something else, thanks for your contribution.

 

<!DOCTYPE html>
<html>

<head>
<style>
.btn {
  width: 200px;  /* Ancho del botón */
  height: 50px;  /* Altura del botón */
}
</style>
</head>


<body>

 


<p>Click the button to get your coordinates.</p>

<button class="btn" onclick="getLocation()">Try It</button>

<p id="demo"></p>

<script>
var x = document.getElementById("demo");

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(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;
  top.ajaxRequest(Ext.get(document.getElementById('uniqueFrameID')).component, 'coords', {latitude: position.coords.latitude, longitude: position.coords.longitude});
}
</script>

</body>
</html>

 

image.png.1761519485a6d2a380db6f9db1f901cc.png

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...