Javascript / PHP可以获取GPS位置并发送给我? [英] Javascript/PHP can I get GPS location and send it to me?

查看:200
本文介绍了Javascript / PHP可以获取GPS位置并发送给我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确定这是我想要的:



我需要类似Javascript或PHP脚本的东西来从访问者获取gps位置,然后秘密发送给我(我不会使用这个不好的,它是为了防止我的iPhone被盗取的网站)



我想如果一个小偷打开网站(我将webclip,名字Safari浏览器,并给Safari浏览器图标)我自动得到他的位置,他被重定向到谷歌或其他东西



所以基本如此:

  navigator.geolocation.getCurrentPosition(GetLocation); 
函数GetLocation(location){
//一些将位置秘密地发送给我的脚本
}
{
windows.location =http:// google。 COM;


解决方案

访问私有的道德问题在没有同意的情况下放置位置信息,浏览器被明确设计为不会无意中透露这一点。这就是为什么您会被要求授予访问HTML 5网站以尝试访问坐标的原因。



您可以做的最好的方法是使用可解决问题的服务将IP地址转换为物理位置,并根据此假设做出一些假设,尽管这种做法的可靠性至多是零星的。

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";
}

解决方案

The ethical questions about accessing private location information without consent aside, browsers are explicitly designed not to inadvertently disclose this. This is why you'll be asked to grant access to an HTML 5 site attempting to gain access to the coordinates.

The best you could do is use a service which resolves the IP address to a physical location and makes some assumptions based on this, although the reliability of this practice is sporadic at best.

这篇关于Javascript / PHP可以获取GPS位置并发送给我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆