73
Views
1
Comments
Solved
[Google Places] Not working on iOS(Safari and Opera)
Question
google-places
Web icon
Forge asset by Ouen Worth

Hello,


I am having a problem when I try to open a page with this component on iOS(11) Safari and Opera. What happens is that I select the address that I want from the component options but it does not stay selected.

Does everyone had this same behaviour before? And/or know how to solve it?


Best regards,



2018-11-15 21-42-52
João Nobre
Solution

I got a workaround that worked.

Add the following script to your page

"<script type='text/javascript'>
$( document ).ready(function() {

    // need to stop prop of the touchend event
    if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
        setTimeout(function() {
            var container = document.getElementsByClassName('pac-container')[0];
            container.addEventListener('touchend', function(e) {
                e.stopImmediatePropagation();
            });
        }, 500);
    }

});
</script>"


I got this solution from: https://gist.github.com/schoenobates/ef578a02ac8ab6726487


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.