[英]Google Place Autocomplete Not working in IE and Safari
I have a google places autocomplete added to a form on my site.我有一个谷歌地方自动完成添加到我网站上的表单。 It works with all major browsers except Internet Explorer on Windows 10, and Old Safari for Windows, as well as the latest Safari for iOS on my iPad.它适用于除 Windows 10 上的 Internet Explorer 和适用于 Windows 的旧版 Safari 以及我的 iPad 上适用于 iOS 的最新 Safari 之外的所有主要浏览器。
EDIT: Just realized it doesnt even work on Chrome on my iOS iPad.编辑:刚刚意识到它甚至不能在我的 iOS iPad 上的 Chrome 上运行。 Odd.奇怪的。
<---HTML--->
<script src="https://maps.googleapis.com/maps/api/js?key=MYKEY&libraries=places"></script>
<input type="text" id="google1" name="pick" placeholder="Pick up location" required/>
<input type="text" id="google2" name="drop" placeholder="Drop off location" required/>
<---Javascript--->
const options = {
componentRestrictions: {
country: 'sg'
}
};
let autocomplete1 = new google.maps.places.Autocomplete(document.getElementById('google1'), options);
autocomplete1.addListener('place_changed', () => console.log(autocomplete1.getPlace()));
let autocomplete2 = new google.maps.places.Autocomplete(document.getElementById('google2'), options);
autocomplete2.addListener('place_changed', () => console.log(autocomplete2.getPlace()));
Is there something I did wrong that it won't work on IE and Safari?是不是我做错了什么,它不能在 IE 和 Safari 上运行? Works well everywhere else.在其他任何地方都适用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.