Javascript 反向地理编码不';不能在移动设备上工作

Javascript 反向地理编码不';不能在移动设备上工作,javascript,reverse-geocoding,nominatim,Javascript,Reverse Geocoding,Nominatim,我正在写一个小网页,我的一个功能就是拍一张照片,并在照片上立即写下位置(街道和城市)。 这是我的密码: window.cb = function cb(json) { document.getElementById('city').value = json.address.road+ " " + json.address.postcode + ',' + json.address.city; } window.search = function search(x,y

我正在写一个小网页,我的一个功能就是拍一张照片,并在照片上立即写下位置(街道和城市)。 这是我的密码:

window.cb = function  cb(json) {
            document.getElementById('city').value = json.address.road+ " " + json.address.postcode + ',' + json.address.city;
}

window.search =  function search(x,y) {
    var s = document.createElement('script');       
    s.src = 'http://nominatim.openstreetmap.org/reverse?json_callback=cb&format=json&lat=' + x + '&lon=' + y + '&addressdetails=1&accept-language=en-US';
    document.getElementsByTagName('head')[0].appendChild(s);

};

....

search(x,y); 
setTimeout(function(){ 
    var city = document.getElementById('city').value;
    context.strokeText(city, 270, 260);
    }, 2000);
它在桌面版上运行良好,但在移动设备上尝试时失败。我尝试将超时设置为更高的值-没有帮助

如有任何建议,将不胜感激。
谢谢。

在手机上执行代码时,控制台中是否出现错误?另外,你能和我们分享HTML吗?所以,我发现了错误。我正在发送http请求(
)http://nominatim.openstreetmap.org...
),但我的手机浏览器需要https…有趣的是,我没有想到这一点。谢谢,但当您在手机上执行代码时,在控制台中是否看到任何错误?另外,你能和我们分享HTML吗?所以,我发现了错误。我正在发送http请求(
)http://nominatim.openstreetmap.org...
),但我的手机浏览器需要https…有趣的是,我没有想到这一点。谢谢