Vec sam dosta vremena izgubio na ovome i nisam shvatio u cemu je problem. Nadam se mi mozete pomoci :)
LINK: https://dev.opera.com/articles/w3c-geolocation-api/basic_geolocation_example.htm
Link radi na: Mozilli, Operi i Chromu.
Ako isti kod kopiram svoju web stranicu tada radi na Mozilli ali u Operi i Chromu dobijem error.
Ne kuzim, kod je potpuno isti, otvaram sa istim preglednikom .
KOD:
******************************************************************************************
<!DOCTYPE html>
<html>
<head>
<title>Extremely basic example of the W3C Geolocation API</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">
//Check if browser supports W3C Geolocation API
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(successFunction, errorFunction);
} else {
alert('Geolocation is required for this page, but your browser doesn't support it. Try it with a browser that does, such as Opera 10.60.');
}
function successFunction(position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
alert('Your latitude is '+lat+' and longitude is '+long);
}
function errorFunction(position) {
alert('Error!');
}
</script>
</head>
<body>
<p>If your browser supports Geolocation, you should get a JavaScript alert with your coordinates.</p>
<p>This is a basic example from <a href="https://dev.opera.com/articles/how-to-use-the-w3c-geolocation-api/">How to use the W3C Geolocation API</a> article on <a href="/">Dev.Opera</a>.
</body>
</html>
*********************************************************************************************