Firefox浏览器中的google-places bug [英] google-places bug in firefox browser

查看:88
本文介绍了Firefox浏览器中的google-places bug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用google-places-autocomplete填写字段地址(地址,城市,国家/地区,邮政编码,纬度,经度)..它在所有浏览器中均能正常工作,但并非每次在Firefox浏览器中都可以工作(这可能会导致通过缓存Firefox浏览器) 代码js:

I use google-places-autocomplete for fill fields address (address ,city,country,postal code, latittude , longitude) .. it work well in all browsers but it doesen't work everytime in firefox browser (it may caused by the cache firefox browser) code js:

        function initializeAutocomplete(id) {
                    var element = document.getElementById(id);
                    if (element) {
                        var autocomplete = new google.maps.places.Autocomplete(element, { types: ['geocode'], language : _mpop.current_lang });
                        if(id == "parent_personal_info_fullAddress" || id == "edit_babysitter_personal_info_fullAddress" ||
                            id == "address_bb" || id == "home_address" ){
                            google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChangedEditUser);
                        }
                    }
                }


        function onPlaceChangedEditUser(){
        var place = this.getPlace();
        $('.postal_code').val('');
        for (var i in place.address_components) {
            var component = place.address_components[i];
            for (var j in component.types) {
                var type_element = $('.'+component.types[j]);
                if(component.types[j] == "country"){
                    $('#country').find('option').attr('selected', false);
                    $('#country').find('option[data-country="' + component.short_name + '"]').attr('selected', true);
                    $('#country_iso').val(component.short_name);
                    $('#country').change();
                    $('.country-short').val(component.short_name);


                }
                if (type_element) {
                    type_element.val(component.long_name);
                }
                if($("#latitude").length){
                    $("#latitude").val(place.geometry.location.lat());
                    $("#longitude").val(place.geometry.location.lng());

                }
                if($(".latitude").length){
                    $(".latitude").val(place.geometry.location.lat());
                    $(".longitude").val(place.geometry.location.lng());
                }


            }
        }
    }

$(document).ready(function () {
google.maps.event.addDomListener(window, 'load', function() {
    initializeAutocomplete('babysitter_search_address');
});
}

推荐答案

如果您指的是有时未加载的地图图块,则这是最近在Google的问题跟踪器中报告的一个已知问题:

If you're referring to the map tiles not loading sometimes, this is a known issue that was recently reported in Google's Issue Tracker:

https://issuetracker.google.com/issues/138267513

它似乎已在v68.0.2中修复.如果由于某种原因您仍无法更新,则可以通过关闭Firefox的缓存来解决此问题.

It appears to have been fixed in v68.0.2. If for some reason you cannot update yet then you can work around this issue by turning off Firefox's cache.

查看其他SO线程:嵌入式Google Maps磁贴只有在缩放后才能加载到Firefox第二页中

希望这可以澄清您的问题.

Hope this clarifies your question.

这篇关于Firefox浏览器中的google-places bug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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