W3C Geolocation API

W3C Geolocation API merupakan upaya oleh World Wide Web Consortium (W3C) untuk membakukan sebuah antarmuka untuk mengambil informasi lokasi geografis untuk perangkat.[1] Ini mendefinisikan satu set objek, ECMAScript standar compliant, yang mengeksekusi dalam aplikasi klien memberikan lokasi perangkat klien melalui konsultasi Server Informasi Lokasi, yang transparan untuk antarmuka pemrograman aplikasi (API). Sumber yang paling umum dari informasi lokasi yang alamat IP, Wi-Fi dan Bluetooth alamat MAC, radio-frekuensi identifikasi (RFID), Wi-Fi lokasi koneksi, atau perangkat Global Positioning System (GPS) dan GSM / CDMA. Lokasi dikembalikan dengan akurasi yang diberikan tergantung pada sumber informasi lokasi terbaik yang tersedia.

Implementasi

Contoh kode

Kode JavaScript simpel yang dapat mengecek peramban web dapat menjalankan Geolocation API atau mempunyai Google Gears untuk membuat objek geolokasi dan menggunakannya untuk mendapatkan lokasi dari alat.

var gl;
 
function displayPosition(position) {
  var p = document.getElementById("p");
  p.innerHTML = "<table border='1'><tr><th>Timestamp</th><td>" + position.timestamp +
  "<tr><th>Latitude (WGS84)</th><td>" + position.coords.latitude + " deg</td></tr>" +
  "<tr><th>Longitude (WGS84)</th><td>" + position.coords.longitude + " deg</td></tr></table>";
}
 
function displayError(positionError) {
  alert("error");
}
 
try {
  if (typeof navigator.geolocation === 'undefined'){
    gl = google.gears.factory.create('beta.geolocation');
  } else {
    gl = navigator.geolocation;
  }
} catch(e) {}
 
if (gl) {
  gl.getCurrentPosition(displayPosition, displayError);
} else {
  alert("Geolocation services are not supported by your web browser.");
}

Daftar Pustaka

  1. ^ Popescu, Andrei (editor, Google Inc.) (22 Desember 2008). "Geolocation API Specification: W3C Candidate Recommendation 07 September 2010". W3C. Diakses tanggal 23 Januari 2013. 

Pranala luar

  • Fitur Firefox 3.5 Geolocation Diarsipkan 2012-05-12 di Wayback Machine. untuk mengembangkan aplikasi lokasi
  • Tutorial dan contoh dari Geolocation API dengan Google Gears
  • Tambah sebuah penyedia layanan lokasi Diarsipkan 2012-01-06 di Wayback Machine. ke Gears
  • WebScanNotes.com - W3C Geolocation API
  • l
  • b
  • s
Produk dan
standar
Rekomendasi
  • ActivityPub
  • Activity Streams
  • ARIA
  • Canonical XML
  • CDF
  • CSS
    • Animations
    • Flexbox
    • Grid
  • DOM
  • Geolocation API
  • HTML
    • HTML5
  • IndexedDB
  • ITS
  • JSON-LD
  • Linked Data Notifications
  • MathML
  • Micropub
  • OWL
  • PLS
  • RDF
    • Schema
  • SISR
  • SKOS
  • SMIL
  • SOAP
  • SRGS
  • SRI
  • SSML
  • SVG
    • Efek filter
  • SCXML
  • SHACL
  • SPARQL
  • Timed text
  • VoiceXML
  • WoT
    • TD
  • Web storage
  • WSDL
  • Webmention
  • WebSub
  • XHTML
    • +RDFa
  • XML
    • Base
    • Encryption
    • Events
    • Information Set
    • Namespace
    • Schema
    • Signature
    • XForms
    • XInclude
    • XLink
    • XOP
    • XPath
      • 2.0
      • 3.x
    • XPointer
    • XProc
    • XQuery
    • XSL
    • XSL-FO
    • XSLT
      • elements
Catatan
  • IndieAuth
  • XAdES
  • XBL
  • XHTML+SMIL
  • XUP
Daftar kerja
  • CCXML
  • CURIE
  • EME
  • InkML
  • MSE
  • RIF
  • SMIL Timesheets
  • sXBL
  • WebGPU
  • WebXR
  • XFDL
  • XFrames
  • XMLHttpRequest
Panduan
Inisiatif
Terdahulu
  • C-HTML
  • HDML
  • JSSS
  • PGML
  • VML
  • WebPlatform
  • XHTML+MathML+SVG
Usang
  • P3P
Organisasi
  • World Wide Web Foundation
Kelompok kerja
  • TAG
  • CSS
  • SVG
  • WebAssembly
  • WebAuthn
  • WHATWG
Kelompok komunitas & bisnis
  • Web Advertising BG
  • WebAssembly CG
Kelompok yang sudah ditutup
  • Device Description (DDWG)
  • HTML
  • Multimodal Interaction Activity (MMI)
Perangkat
lunak
  • CERN httpd
  • Libwww
Peramban
  • Line Mode (1990–)
  • Arena (1993–1998)
  • Agora (1994–1997)
  • Argo (1994–1997)
  • Amaya (browser/editor, 1996–2012)
Konferensi