3

I'm using the Google Maps AutoComplete interface to do automatic look up of locations as the user types. It works great on all browsers I tested (Chrome, FireFox, iOS and newer Android devices), except Windows Phone.

On Windows phone the places_changed event doesn't appear to be firing, nor is the text box automatically updating as it does on other browsers.

Here's a simplified scenario that demonstrates with a single textbox on a form:

<div class="container" style="padding: 40px">
    <label>Enter a location</label>
    <input id="location" value="" class="form-control" />
</div>

<script type="text/javascript"
        src="http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true&libraries=places">
</script>
<script>
    var el = document.getElementById('location');
    var autocomplete = new google.maps.places.Autocomplete(el);

    google.maps.event.addListener(autocomplete, 'place_changed', function () {                
            var place = autocomplete.getPlace();
            if (place.geometry.location)
                // delay setting the value - otherwise maps uses default always
                setTimeout(function() { el.value = place.name; }, 200);
        });
</script>

You can try this out at: http://embed.plnkr.co/kAwU0Fl97nEQr5HhxOTH/preview

It works fine in all browsers (including IE 11 which supposedly uses the same rendering engine as Windows Phone 8), but on Windows Phone the drop down box pops up, but neither the automatic update for the textbox fires, nor the explicit event code that updates the text with the name only.

Is there any way to work around this?

Rick Strahl
  • 17,302
  • 14
  • 89
  • 134
  • Is the missing timeout parameter to the first `setTimeout` intentional? – Duncan Smart Feb 20 '14 at 12:58
  • Duncan actually it should be necessary at all, but added (also with actual timeouts) to delay execution of hooking up the event handler after the current handler. Even larger values didn't work - makes no difference. Going to remove it as it really didn't add anything. – Rick Strahl Feb 21 '14 at 02:55
  • This does not work on my Windows Phone emulator, there are no suggestions appearing for the text box. What could be the reason? – S_S Mar 03 '16 at 11:09

1 Answers1

3

Does anyone have any more info on this? I have run into the same problem - Google Autocomplete Places text box works fine on all desktop browsers, and almost all mobile phone browsers, with Windows Phone being the exception - you cannot select an entry in the list on Windows Phones.

I have now tested a website using Google Places autocomplete on a Windows Phone 7.5, Windows Phone 7.8, and Windows Phone 8.0

The Windows Phone 7.5 didnt't work at all, (didn't even display the page), and the 7.8 and 8.0 phones display the above error of showing the correct drop down, but not being able to select an entry.

I haven't been able to test on the forthcoming Windows Phone 8.1 update yet (which is available as a developer pre-release update, but isn't available to phone end-users for another month yet).

I am sort of hoping that the Windows Phone 8.1 update might bring a solution. In testing I have noted that Windows Phone 7.5/8 declare that they use 'Internet Explorer 9' (mobile edition), and that Windows Phone 8.0 uses 'Internet Explorer 10' (mobile edition). The upcoming Windows Phone 8.1 update supposedly uses 'Internet Explorer 11'.

This thread is 2 months old, and there is an older thread (8 months) which is similar at Google places autocomplete not working in Windows mobile IE Browser

The issue has also been reported on a Google board at https://code.google.com/p/gmaps-api-issues/issues/detail?id=6120

Hopefully Google will pick this up, or does anyone else have a possible fix for this?

Edit: I contacted Google support, who pointed me to the officially supported Google Maps JavaScript API supported browser FAQ:

https://developers.google.com/maps/faq#browsersupport

Google specifically support all desktop browsers, and mobile browsers on iOS and Android. They do NOT support use of the Javscript client API on Windows Phones/Mobile devices.

Community
  • 1
  • 1
yorkshirespud
  • 727
  • 6
  • 14
  • Behavior hasn't improved on Windows Phone 8.1 - the list pops up but the selection doesn't trigger the selection event, the list just disappears as with WP 8.0. This has got to be something simple that either Microsoft or Google could fix, but neither seem to care... – Rick Strahl Jul 25 '14 at 22:29
  • Any update on this issue? I'm seeing a similar issue on the android version of Firefox. I saw this related post on SO http://stackoverflow.com/questions/29174957/google-places-autocomplete-plugin-isnt-working-in-firefox-android but there are no responses. Were you guys able to find a workaround for Windows Phone? – rogerb Mar 27 '15 at 17:12
  • 1
    What is the present status of this issue? – S_S Mar 02 '16 at 06:42