ironheartbj18 Posted April 18, 2014 Share Posted April 18, 2014 (edited) I am using chrome. why the geolocation wont showing getLocation i checked on my advance setting there is no necessarily checkbox "Send a "Do Not Track" request with your browsing traffic" I am not sure what excalty the file will go through from the document.getElementById("demo"). I checked at http://www.w3schools.com/html/html5_geolocation.asp it does not help me please help me to success what did i wrong anyone who have experienced this problem before thanks! btw, I am using IDE note++ here the code is <!DOCTYPE html> <html> <body> <p>Click below to get your coordinates:</p> <button onclick="showLocation()">Click</button> <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; } </script> </body> </html> Edited April 18, 2014 by davej Link to comment Share on other sites More sharing options...
davej Posted April 18, 2014 Share Posted April 18, 2014 Your code looks wrong. Your button calls a non-existent function. Does this example work for you or not? http://www.w3schools.com/html/html5_geolocation.asp Link to comment Share on other sites More sharing options...
ironheartbj18 Posted April 18, 2014 Author Share Posted April 18, 2014 (edited) I made the video making things of thousand description what is going on and easier for you to understand https://www.youtube.com/watch?v=igM41r4Rzko&feature=youtu.be it only give a minute. you will see the setting on chrome there have three checkboxs on list. w3school.com is working notepad++ is NOT working???????????????????? seem its not right... it wont let me approved or blocked in somewhat. please help thanks! Edited April 18, 2014 by ironheartbj18 Link to comment Share on other sites More sharing options...
davej Posted April 18, 2014 Share Posted April 18, 2014 As I said in this thread you need to load your code onto a server. It won't work sitting on your desktop. Link to comment Share on other sites More sharing options...
ironheartbj18 Posted April 18, 2014 Author Share Posted April 18, 2014 now i get it thanks you very much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now