Jump to content

Search the Community

Showing results for tags 'Geolocation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 9 results

  1. Hello, A question about this code: function showError(error) { switch(error.code) { case error.PERMISSION_DENIED: x.innerHTML = "User denied the request for Geolocation." break; case error.POSITION_UNAVAILABLE: x.innerHTML = "Location information is unavailable." break; case error.TIMEOUT: x.innerHTML = "The request to get user location timed out." break; case error.UNKNOWN_ERROR: x.innerHTML = "An unknown error occurred." break; } } According to the Geolocation spec. , there are 3 constants representing errors: PERMISSION_DENIED, POSITION_UNAVAILABLE, and TIMEOUT. It doesn't mention UNKNOWN_ERROR So I don't understand how the case of error.UNKNOWN_ERROR fits in the code. Was it predefined anywhere else? what will it return? and how can I cause an (intentional) unknown error to trigger this case? Thank you very much for any assistance.
  2. Hello frns, i learnt how to get the gps coordinates from w3school tutorials but a small question how to alter the user if he blocks the gps access request through code <script> var x = document.getElementById("gpsloc"); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition, showError); } else { x.value = "Geolocation is not supported by this device."; } } function showPosition(position) { x.value = position.coords.latitude + "," + position.coords.longitude; } function showError(error) { switch(error.code) { case error.PERMISSION_DENIED: x.value = "User denied the request for Geolocation." break; case error.POSITION_UNAVAILABLE: x.value = "Location information is unavailable." break; case error.TIMEOUT: x.value = "The request to get user location timed out." break; case error.UNKNOWN_ERROR: x.value = "An unknown error occurred." break; } } </script> what i want to make is page should check the state of permission and if permission is denied page should alert or keep re-request permission to allow please assist
  3. My weather function works when I enter the coordinates myself. I'm trying to use a get location function to find and enter them in but it's not working. Please help. //////////////////////////////////////////////////////////////////////////////////////////////// var x = document.getElementById("demo"); function showLocation(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; x.innerHTML = latitude + "," + longitude; } function errorHandler(err) { if(err.code === 1) { alert("Error: Access is denied!"); } else if( err.code === 2) { alert("Error: Position is unavailable!"); } } function getLocation(){ if(navigator.geolocation){ // timeout at 60000 milliseconds (60 seconds) var options = {timeout:60000}; navigator.geolocation.getCurrentPosition(showLocation, errorHandler, options); } else{ alert("Sorry, browser does not support geolocation!"); } } /////////////////////////////////////////////////////////////////////////////////////////////// function updateWeather() { var xmlHttp = new XMLHttpRequest(), location = x; xmlHttp.overrideMimeType("application/json"); xmlHttp.open("GET", URL_WEATHER_DATA + location + URL_WEATHER_DATA2,false);
  4. Hi, So it seems that since the Chrome updated to version 50 They have removed HTML 5 Geo location on HTTP due to security. Now they do however say that it shall all work fine using a localhost for testing as it is being seen as a secure host yet it seems this does not work using a virtual host. If i do a test on "test.local" i will get the same deprecation messages as on a HTTP server but when i change it to "localhost" and run it again it all seems fine. Does anyone know a workaround to still be able to use Geo location using a virtual host or am i now stuck using localhost? Thanks
  5. The geolocation code gives an error Location information is unavailable. Here is the link to the code http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation_error I don't know why the error is coming. Please help me out I am heavily stuck at this point..
  6. Hi,I am building a classifieds WordPress website and I would like to know does there exist any plugin or method that allow posts to be shown based on the country/region/city of the visitor (ip based listing)? There should be an option to add the location of the post somehow in the admin panel so that the plugin can use the information and show the nearest posts. I ve been shown these two links but i dont know how to do it: http://html5demos.com/geo, http://www.w3schools.com/html/html5_geolocation.asp Thanks
  7. I can't use the function of geolocation in my desktop. Browsers are Firefox and Google Chrome. OS is window xp. I click the button to get positon and also click "share position info" The result: Firefox alert "Unknown error acquiring position" Google Chrome alert "Javascript notice: User denied Geolocation" <!doctype html><html> <head> <meta charset="utf-8"> <title>Geolocation test</title> </head> <body> <p>Your latitude:<span id = "latitude">000</span></p> <p>Your longitude:<span id = "longitude">000</span></p> <p><button onClick="getPosition()">click for your position</button></p> <script> function getPosition(){ if(navigator.geolocation){ navigator.geolocation.getCurrentPosition(showPosition, errorMessage); } else{ alert("this browser does not support geolocation"); } } function showPosition(position){ document.getElementById("latitude").innerHTML = position.coords.latitude; document.getElementById("longitude").innerHTML = position.coords.longitude; } function errorMessage(error){ alert(error.message); } </script> </body></html> I am trying to solve the problem by searching Google. I got some information in the following link: https://bugzilla.mozilla.org/show_bug.cgi?id=822967 Some people said that desktop can't use geolocation. Is it right? Any solution?
  8. 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>
  9. Hi folks, as the lovely HTML5 coming and proving that it's an unbelievable language , I found the new technique "Geolocation" very helpful to my project. as a part of my project, I have a simple form gathering info from the user such as name , email andthe latitude and longitude of the user's position. In w3schools's example , the latitude and longitude are returned as normal text above each other :Latitude: 00.0000Longitude: 00.0000 ( not really zeros ) my question is: after clicking on a button (say get location) , the latitude and longitude coords will be automatically inserted (filled) into 2 input boxes ( visible or hidden ) to be sent to the database after submitting the Form . is it something to do with innerHTML ? how to do that ? <form action="handle_form.php" method="post"> <p>Name: <input type="text" name="name" size="20" /></p> <p>Email Address: <input type="text" name="email" size="20" /></p> <p id="demo">Click the button to get your coordinates:</p><button onclick="getLocation()">Try It</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></form> the geolocation part code from here:http://www.w3schools...ml5_geolocation
×
×
  • Create New...