java - HTTP 中的地理位置
问题描述
我正在尝试获取用户的地理位置以在 http 网站的文本框中发布。我一直在测试中使用下面的代码,效果很好,但一旦部署就不起作用。
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success);
} else {
alert("Geo Location is not supported on your current browser!");
}
function success(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
$('#click4').click(function () {
document.getElementById('lat2').value = latitude + "." + longitude;
});
我需要帮助弄清楚如何在 http 中进行这项工作。
解决方案
推荐阅读
- java - 如何在多个活动之间共享公共代码?拜托,这不是一个重复的问题
- python - 定义一个函数,该函数使用 Python 中其他两个文本文件中的字符串创建文本文件
- php - 基于相同键但不同键值的数组合并应添加为单独的数组
- php - 将文件从 php 发送到另一个 api wordpress
- vespa - 如何在 vespa.ai 中合并(联合)多个搜索文档?
- swift - Xcode tintedImageProvider 用于 Apple Watch 复杂功能 rectangleTemplate.imageProvider
- javascript - Wiredjs Web 组件不发送表单
- reactjs - 赛普拉斯没有检测来自 cy.route() 的路由
- javascript - 在 plotly 模板中添加多个 csv 文件
- reactjs - 如何显示蚂蚁设计时间选择器未来时间