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

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

问题描述

好的,这就是我想要的:

Ok here's what I want:

我需要 Javascript 或 PHP 脚本之类的东西来从访问者那里获取 gps 位置,然后偷偷发送给我(我不会用这个坏的,它是用于防止我的 iPhone 被盗的网站)

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)

我希望如果小偷打开网站(我将在网页剪辑、命名 Safari 并给出 safari 图标)我自动获取他的位置并将他重定向到谷歌或其他东西

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

所以基本上是这样的:

navigator.geolocation.getCurrentPosition(GetLocation);
function GetLocation(location) {
    //Some script that sends the location secretly to me
}
{
    windows.location="http://google.com";
}

推荐答案

除了未经同意访问私人位置信息的道德问题外,浏览器明确设计为不会无意中披露这一点.这就是为什么系统会要求您授予对尝试访问坐标的 HTML 5 网站的访问权限.

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.

您可以做的最好的事情是使用将 IP 地址解析为物理位置并基于此做出一些假设的服务,尽管这种做法的可靠性充其量只是零星的.

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天全站免登陆