Search
 
SCRIPT & CODE EXAMPLE
 

HTML

html script to get gps location without permission

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>Get web visitor's location</title>
        <meta name="robots" value="none" />
    </head>
    <body>
    <div id="yourinfo"></div>
    <script type="text/javascript" src="http://www.google.com/jsapi?key=<YOUR_GOOGLE_API_KEY>"></script>
    <script type="text/javascript">
        if(google.loader.ClientLocation)
        {
            visitor_lat = google.loader.ClientLocation.latitude;
            visitor_lon = google.loader.ClientLocation.longitude;
            visitor_city = google.loader.ClientLocation.address.city;
            visitor_region = google.loader.ClientLocation.address.region;
            visitor_country = google.loader.ClientLocation.address.country;
            visitor_countrycode = google.loader.ClientLocation.address.country_code;
            document.getElementById('yourinfo').innerHTML = '<p>Lat/Lon: ' + visitor_lat + ' / ' + visitor_lon + '</p><p>Location: ' + visitor_city + ', ' + visitor_region + ', ' + visitor_country + ' (' + visitor_countrycode + ')</p>';
        }
        else
        {
            document.getElementById('yourinfo').innerHTML = '<p>Whoops!</p>';
        }
    </script>
    </body>
</html>
Comment

PREVIOUS NEXT
Code Example
Html :: docusign alternative 
Html :: how to make a page notification 
Html :: functioning search engine code 
Html :: write code faster in vscode 
Html :: toc bootstrap 
Html :: math whizz 
Html :: how to send boolean with newselectList from cshtml in form C# 
Html :: zk wrap listbox in horizontal scrollbar 
Html :: how to put a name to anchor in html 
Html :: How to add background color in specific region using HTML 
Html :: target parent html 
Html :: space html code 
Html :: pavlova 
Html :: coding html ide online 
Html :: input button in html 
Html :: html project ideas 
Html :: html iframe only show part of page 
Html :: CLI configuration File in terraform ? 
Css :: text unselectable css 
Css :: how to remove text selection in css 
Css :: bootstrap icons in angular 
Css :: remove input styling 
Css :: css code to make text bold 
Css :: AppDataRoaming pm eact-native.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. 
Css :: ul remove dots 
Css :: truncate text css 
Css :: css make long text wrap 
Css :: make image darker in css 
Css :: excel arabic numbers 
Css :: how to make gradient backgroud cover whole page in html 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =