简体   繁体   English

使用Javascript在Blackberry上访问GPS并通过url向服务器发送经纬度值

[英]Accessing GPS on Blackberry using Javascript and sending lat/long values to a server via url

When you obtain the lat/long values from a GPS enabled blackberry device, how do you send those values to a server via a url? 当您从启用GPS的黑莓设备获取经度/纬度值时,如何通过网址将这些值发送到服务器? By the way, I'm trying to do this in Javascript. 顺便说一句,我试图用Javascript做到这一点。 "window.location.href=..." works fine on the iphone. "window.location.href=..."在iPhone上可以正常使用。

I was thinking something like this would work but it doesn't seem to: 我在想像这样的事情会起作用,但似乎不起作用:

function locationCB() {                                 
    window.location.href="http://www.somewebsite.com/latitude:"+blackberry.location.latitude+"/longitude:"+blackberry.location.longitude;
    return true;
}

if ( window.blackberry && blackberry.location.GPSSupported) {
        blackberry.location.onLocationUpdate("locationCB()");
        blackberry.location.setAidMode(2);
        blackberry.location.refreshLocation();
}

I wish I had a better answer (still looking for it myself). 我希望我有一个更好的答案(自己仍然在寻找它)。 However, what I DO know is that most BlackBerry's don't support JavaScript. 但是,我知道的是,大多数BlackBerry都不支持JavaScript。

Good news is that it is compatible with Geolocation. 好消息是它与Geolocation兼容。

Here's a link for its variables: http://docs.blackberry.com/en/developers/deliverables/11844/Support_for_Gears_APIs_738961_11.jsp 这是其变量的链接: http : //docs.blackberry.com/en/developers/deliverables/11844/Support_for_Gears_APIs_738961_11.jsp

If the problem is to send data to server, try this: 如果问题是将数据发送到服务器,请尝试以下操作:

http://www.somewebsite.com/[page with gps gather code] ?latitude=[value]&longitude=[value] http://www.somewebsite.com/ [带有gps的页面收集代码] ?latitude = [value]&longitude = [value]

See 看到
Using URL Parameters 使用URL参数
How to send GPS data using HTTP to your web site 如何使用HTTP将GPS数据发送到您的网站

Code to parse url parameters will depend on server platform 解析url参数的代码将取决于服务器平台

ASP.NET Passing Parameters from One Page to Another ASP.NET将参数从一页传递到另一页
how to extract parameter from URL using PHP 如何使用PHP从URL提取参数
Java - Access parameters passed in the URL Java-在URL中传递的访问参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM