<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Geolocation &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/geolocation/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>HTML5 geolocation &#8211; What If the User Doesn&#8217;t Share His Position?</title>
		<link>/2010/06/29/html5-geolocation-what-if-the-user-doesnt-share-his-position/</link>
		<comments>/2010/06/29/html5-geolocation-what-if-the-user-doesnt-share-his-position/#respond</comments>
		<pubDate>Tue, 29 Jun 2010 18:29:01 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Free software]]></category>
		<category><![CDATA[FTP clients]]></category>
		<category><![CDATA[Geo]]></category>
		<category><![CDATA[Geolocation]]></category>
		<category><![CDATA[GPS]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[mobile phones]]></category>
		<category><![CDATA[Mozilla Firefox]]></category>
		<category><![CDATA[Technology/Internet]]></category>

		<guid isPermaLink="false">/?p=1720</guid>
		<description><![CDATA[HTML5 Geolocation So far we were used to expect something like this from our mobile phones with built-in GPS support. Every image or video clip then was automatically &#8220;tagged&#8221; with latitude &#38; longitude geo data. With HTML5 coming features we discover new cool things we can do with our browsers. Such cool thing is the &#8230; <a href="/2010/06/29/html5-geolocation-what-if-the-user-doesnt-share-his-position/" class="more-link">Continue reading <span class="screen-reader-text">HTML5 geolocation &#8211; What If the User Doesn&#8217;t Share His Position?</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/01/31/speed-up-the-javascript-it-can-change-dramatically-the-user-experience/" rel="bookmark" title="Speed up the JavaScript. It can change dramatically the user experience.">Speed up the JavaScript. It can change dramatically the user experience. </a></li>
<li><a href="/2011/02/04/reading-gps-latitude-and-longitude-from-image-and-video-files/" rel="bookmark" title="Reading GPS Latitude and Longitude from Image and Video Files">Reading GPS Latitude and Longitude from Image and Video Files </a></li>
<li><a href="/2010/02/24/storing-javascript-objects-in-html5-localstorage/" rel="bookmark" title="Storing JavaScript objects in html5 localStorage">Storing JavaScript objects in html5 localStorage </a></li>
<li><a href="/2010/03/04/does-firefox-play-mp4-h-264-within-the-html5-video-tag/" rel="bookmark" title="Does Firefox play mp4 h.264 within the HTML5 video tag?">Does Firefox play mp4 h.264 within the HTML5 video tag? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>HTML5 Geolocation</h2>
<p>So far we were used to expect something like this from our mobile phones with built-in GPS support. Every image or video clip then was automatically &#8220;tagged&#8221; with latitude &amp; longitude geo data. With HTML5 coming features we discover new cool things we can do with our browsers. Such cool thing is the geolocation.</p>
<p><a href="/wp-content/uploads/2010/06/geo-location.jpg"><img class="aligncenter size-full wp-image-1726" title="geo-location" src="/wp-content/uploads/2010/06/geo-location.jpg" alt="Geo Location" width="430" height="134" srcset="/wp-content/uploads/2010/06/geo-location.jpg 430w, /wp-content/uploads/2010/06/geo-location-300x93.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<h2>Support</h2>
<p>As you may guess not every browser is supporting these HTML5 features, but out in the web there is quite good collection of tables comparing different browsers and their support level.</p>
<h2>Firefox</h2>
<p>This &#8211; as expected is a browser that supports this geo tagging. First of all you&#8217;ve to allow your browser to use your geo coordinates, as this can be private information.</p>
<p><a href="/wp-content/uploads/2010/06/browser-geo-location.png"><img class="aligncenter size-full wp-image-1728" title="browser-geo-location" src="/wp-content/uploads/2010/06/browser-geo-location.png" alt="Browser GEO Location" width="430" height="51" srcset="/wp-content/uploads/2010/06/browser-geo-location.png 430w, /wp-content/uploads/2010/06/browser-geo-location-300x35.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>Once you do it you can access the geo coordinates, which by the way are quite accurate, with JavaScript.</p>
<h2>What if you don&#8217;t share your position?</h2>
<p>What happens if you don&#8217;t want to share your position? Actually I ran in this situation and as my application waited the coordinates &#8211; it was completely blocked.</p>
<p>The examples doesn&#8217;t show you something special. They simply describe how to get the coordinates, but doesn&#8217;t tell you what if the user doesn&#8217;t click on the &#8220;share&#8221; button.</p>
<pre lang="javascript">
if (!!navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(getPos);
}
...

function getPos(position) 
{
    position.coords.latitude;
    position.coords.longitude;
}
</pre>
<p>Of course getPos() can be simply an anonymous function:</p>
<pre lang="javascript">
if (!!navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(function(position) {
            position.coords.latitude;
            position.coords.longitude;
        });
}
</pre>
<p>Only the Firefox documentation tells you how to handle errors, simply add one more parameter &#8211; callback, for getCurrentPosition() method:</p>
<pre lang="javascript">
if (!!navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(getPos, onError);
}
...

function getPos(position) 
{
    position.coords.latitude;
    position.coords.longitude;
}

function onError()
{
   // handle error
}
</pre>
<p>Now you know where you don&#8217;t want to be.</p>
<p><a href="/wp-content/uploads/2010/06/map-marker.jpeg"><img src="/wp-content/uploads/2010/06/map-marker.jpeg" alt="Map Marker" title="map-marker" width="430" height="286" class="aligncenter size-full wp-image-1731" srcset="/wp-content/uploads/2010/06/map-marker.jpeg 430w, /wp-content/uploads/2010/06/map-marker-300x199.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/01/31/speed-up-the-javascript-it-can-change-dramatically-the-user-experience/" rel="bookmark" title="Speed up the JavaScript. It can change dramatically the user experience.">Speed up the JavaScript. It can change dramatically the user experience. </a></li>
<li><a href="/2011/02/04/reading-gps-latitude-and-longitude-from-image-and-video-files/" rel="bookmark" title="Reading GPS Latitude and Longitude from Image and Video Files">Reading GPS Latitude and Longitude from Image and Video Files </a></li>
<li><a href="/2010/02/24/storing-javascript-objects-in-html5-localstorage/" rel="bookmark" title="Storing JavaScript objects in html5 localStorage">Storing JavaScript objects in html5 localStorage </a></li>
<li><a href="/2010/03/04/does-firefox-play-mp4-h-264-within-the-html5-video-tag/" rel="bookmark" title="Does Firefox play mp4 h.264 within the HTML5 video tag?">Does Firefox play mp4 h.264 within the HTML5 video tag? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/29/html5-geolocation-what-if-the-user-doesnt-share-his-position/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
