無 SSL 連線的 HTML5 地理位置
HTML 5 地理位置用於找出使用者的位置。這可以在沒有 SSL 連線的情況下完成。這可以透過如下方式生成 −
// Variable apigeo shows successful location:
var apigeo = function(position) {
alert("API geolocation success!
lat = " + position.coords.latitude + "
lng = " + position.coords.longitude);
};
var tryapigeo = function() {
jQuery.post( "check the location on google map", function(success) {
apiGeolocationSuccess({coords: {latitude: success.location.lat, longitude: success.location.lng}});
}) //Gives success on given geolocation
.failure(function(err) { //On failure, alert with failure is shown
alert("error while showing geolocation!
"+err);
});
};然後,可以針對錯誤程式碼生成各種 switch case,不同的錯誤程式碼對應不同的錯誤。
var tryloc = function() {//tryloc variable show current position
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
browserGeolocationSuccess, browserGeolocationFail,{
maximumAge: 70000, timeout: 40000, enableHighAccuracy: true});
/ /this will show result with high accuracy
}};
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP