location nearby html

Solutions on MaxInterview for location nearby html by the best coders in the world

showing results for - "location nearby html"
Mei
30 Jun 2018
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE html>
3<html>
4    <head>
5        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6        <title>Reports</title>
7        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
8        <meta name="google" value="notranslate" />
9        <meta name="application-name" content="GeoLocator" />
10        <meta name="description" content="HTML5's approach to email" />
11        <meta name="application-url" content="https://developer.mozilla.org" />
12        <meta name="google" content="notranslate" />
13        <!--
14        <link rel="canonical" href="https://mail.google.com/mail/" />
15        <link rel="shortcut icon" href="https://ssl.gstatic.com/ui/v1/icons/mail/images/favicon2.ico" type="image/x-icon" />
16        <link rel="alternate" type="application/atom+xml" title="Gmail Atom Feed" href="feed/atom" />
17            -->
18        <script type="text/javascript">
19            // <![CDATA[
20            var options = {
21                enableHighAccuracy: true,
22                timeout: 5000,
23                maximumAge: 0
24            };
25
26
27            var x = null;
28
29            function success(position) {
30                var lat = position.coords.latitude;
31                var lon = position.coords.longitude;
32                var accuracyInMeters = position.coords.accuracy;
33
34
35                x.innerHTML = "Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude;
36            }
37
38
39            function error(err)
40            {
41                console.warn('ERROR(' + err.code + '): ' + err.message);
42                x.innerHTML = '<span style="color: red;">No fix on location</span>';
43            }
44
45            function getLocation() {
46                if (navigator.geolocation) {
47                    // https://developer.mozilla.org/en-US/docs/Web/API/Geolocation.getCurrentPosition
48                    // First of all, realise that the default timeout for getCurrentPosition is infinite(!). 
49                    // That means that your error handler will never be called if getCurrentPosition hangs somewhere on the back end.
50
51                    navigator.geolocation.getCurrentPosition(success, error, options); // Error and optios can be omitted
52                } else {
53                    alert("not supported")
54                    x.innerHTML = "Geolocation is not supported by this browser.";
55                }
56
57            }
58
59
60
61
62
63            document.addEventListener('DOMContentLoaded', function ()
64            {
65                x = document.getElementById("demo");
66                /*fun code to run*/
67                getLocation();
68            })
69
70
71
72
73            // ]]>
74        </script>
75
76
77        <style type="text/css" media="all">
78            html, body {
79                width: 100%;
80                height: 100%;
81                margin: 0px;
82                padding: 0px;
83            }
84
85        </style>
86
87
88    </head>
89    <body>
90        <div id="demo"></div>
91
92    </body>
93</html>
94
queries leading to this page
location nearby htmllocation nearby html