Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting geo-uri-support

Is there a way with JavaScript to check whether the client-browser supports the GEO-URI-scheme?

I want to show a coordinate for nonsupported browsers as a link to a map

<a href='http://osm.org/#map=18/52.51627/13.37769'>Berlin</a>

and for supported browsers (like smartphones) as a link to their own native apps.

<a href='geo:52.51627,13.37769'>Berlin</a>
like image 281
cyper Avatar asked Nov 05 '13 10:11

cyper


People also ask

How do you use Geo URI?

A simple geo URI might look like: geo:37.786971,-122.399677. where the two numerical values represent latitude and longitude respectively, and are separated by a comma.

What is a geo link?

A geo link consists basically in a url with a base slug that is common to every link and destination slug. For example in http://yourdomain.com/goto/amazon-product the base slug is "goto" and the destination slug is "amazon-product".

Do any apps support “geo” URIs?

The following applications / software / sites do already support “geo:” URIs: Android supports a “geo:” intent, however, the implementation is based off a very old draft version of the specification, and includes some proprietory extensions.

What is the new definition of a “geo” URI?

The new definition requires a URI rather than the lat/lon tupel as value, and notes in an example that the “geo:” URI scheme is “particularly well-suited”, although other URI schemes are allowed too. A example vCard using the “geo:” URI looks like this (edited for brevity): BEGIN:VCARD VERSION:4.0 FN:Simon Perreault ...

How to extract latitude and longitude from a geo URI?

The browser extracts latitude and longitude from a geo: URI entered or clicked on, and redirects the user to the respective location on OpenStreetMap. Very cool. An initiative called “ GeoSMS ” proposes the use of “geo:” URIs in text messages (mobile short messages – SMS).

Will sipcore use “geo” URIs in its “location conveyance” draft?

After the VCARDDAV working group has included “geo:” URIs in their revision of the vCard scheme, the SIPCORE working group is now discussing the use of “geo:” in their “Location Conveyance” draft. SIP is the IETF’s protocol for establishing Realtime Application Sessions, and is very commonly used for Voice over IP.


1 Answers

No, there isn't. Wether or not the geo protocol is available isn't up to the browser, but the underlying OS. Android's browser has no idea if it can support it, it asks the subsystem if it has a handler for the geo URI, and if so, open it. The only way to know that the system supports a custom uri would be to try and open a link, and seeing if it works. There wouldn't be a way to do this automatically without completely interrupting the user.

A good example on the best way to do this would be Apple's maps.apple.com. They use server-side UA sniffing to redirect maps.apple.com to the best site available.

Trying to go to http://maps.apple.com/?q=cupertino on any mavericks browser will result in them sending a 302 to a maps:// url (the custom URI for the Maps.app app). Same for iOS devices. If it is an unrecognized browser, it will redirect to the corresponding maps.google.com address, since they don't have their own maps web presence.

like image 72
Patrick Avatar answered Sep 23 '22 03:09

Patrick