title: gps geolocation coordinate stucked in PWA js
body: <p>I am facing an issue with stucked gps coordinates using geolocation in a pwa.
  The problem is that sometimes, the coordinates stucked in the previous location. For example I got the location of a place, the user was an hour ago.</p>
  <p>I believe this cases I got the location of the last location the gps could track.</p>
  <p>Is there anyway to refresh the gps, and only send the data once gps has valid, refreshed connection?</p>
  <p>The code for geolocation:</p>
  <pre><code>   if (&quot;geolocation&quot; in navigator &amp;&amp; navigator.geolocation != null) {
                  try {
                      navigator.geolocation.getCurrentPosition(position =&gt; {
                          //if geolocation has valid connection
                          console.log(position);
                          $('#geolocation_form_latitude').val(position.coords.latitude);
                          $('#geolocation_form_longitude').val(position.coords.longitude);
                          $('#geolocation_form').submit();
  
                      }, error =&gt; {
                          $('#geolocation_form').submit();
                      })
                  }
                  catch (e) {
                      $('#geolocation_form').submit();
                  }
       }
  </code></pre>