Today, I had an odd issue which took me a couple minutes to solve. I was trying to make a link from a PhoneGap iOS application to Google Maps. My intent was to have these links show using the Childbrowser plugin, which, I had installed and working for other links but for some reason Google Maps was loading as a blank page. I was using the Google Maps URL:
http://maps.google.com/?q=154 S. Madison Ave Spokane WA 99201 |
If I visit this URL in my browser it loads as expected, however, when I attempted to load the exact same URL in PhoneGap using Childbrowser it failed with no errors. I played around with the URL for awhile and finally determined that PhoneGap and Childbrowser won’t accept spaces in the URL. I didn’t test if this is a function of the UIWebView that is used to render code in PhoneGap or if this applies to mobile Safari as well but I would guess it probably has something to do with the UIWebView/Childbrowser combination. The problem was easily solved by modifying my URL to:
http://maps.google.com/?=154+S+Madison+Ave+Spokane+WA+99201 |
This problem is not limited just to Google Maps. Spaces and other non URL friendly characters will cause problems, so, make sure to properly encode your URL before sending it to Childbrowser. I should’ve done this in the first place but I was being lazy!
Hi Ryan,
Doing something similar with Phonegap (re: displaying a set Google Map (hand drawn bike trail in My Places) via a childbrowser (actually using InAppBrowser now). Everything works fine except that I can’t figure out a way to Geolocate. I get all of the Google Map controls in the new window, but the location button won’t do anything unless I back out into iphone settings/General/Reset Location and Privacy. Then the button will work one time then stop working until I reset again. Weeks of “wasted” time on this. Any suggestions?
Thanks heaps in advance.
Lucas