Possible Duplicate:
Javascript/PHP can I get GPS location and send it to me?
Ok here’s what I want:
I need something like a Javascript or PHP script to get a gps location from a visitor, and then secretly send it to me (I won’t use this bad, it’s for an website that prevents my iPhone from being stolen)
I want that if a thief opens the website (which I will webclip, name Safari and give the safari icon) I automatically get his location and he’s redirected to google or something else
So basically like this:
navigator.geolocation.getCurrentPosition(GetLocation);
function GetLocation(location) {
//Some script that sends the location secretly to me
}
{
windows.location="http://google.com";
}
Can you help me please?
PS: I won’t use this bad because it will only be on my iPhone, I know that there apps for it, but those cost money and I don’t know if it’s worth it.
UPDATE:
I found the following: I don’t know what it really does but I guess it takes the location and sends it to location.php ???
function ajaxFunction() {
$.ajax({
url:'location.php',
type:'POST',
data:'lat='+lat+'&long='+long,
success:function(d){
console.log(d);
},
error(w,t,f){
console.log(w+' '+t+' '+f);
}
});
}
Now how do I make it redirect to google and put this on my website?
Open the site and grant it access to the location, selecting “remember this decision” or whatever the option is called. Then the prompt will not appear in the future.
However, it might be a better idea to write an app for this.