On why Google Maps doesn't work on Mac

A couple weeks ago, I wrote an article on mapping a single address using the Google Maps API in FileMaker.  It concluded that the the obvious technique, simply building a correctly-formatted JavaScript page and displaying it in the Web Viewer with a data:url, wouldn't work on MacOS X.  In this article, I'd like to delve into the technical reasons I this doesn't work.  Read on if you're so inclined...


In the technique I proposed, the HTML was created and displayed in the Web Viewer using a data url.  This technique worked on PC but didn't work on Mac.  I endeavored to find out why.

It comes down to understanding a couple things about the Google Maps API:

  1. It requires a specific API key for a given host (e.g. proofgroup.com)
  2. If there is not host (i.e. a local file), any API key can be used

The first item says that if you host a Google Map using the API, then the key you use must match the host you are using.  That makes sense.  I can't take a file hosted at one server and move it to another server without getting my own key.

On the other hand, the second item says that if the file is opened locally and has no host, then you can use any API key.  Any key will do.


The FileMaker Web Viewer doesn't fit either one.  Internally, it seems to use a 'random' (or random-like) host which cannot be predicted and over which we have no control.  What sort of host does it use?  Something like this:

81DE5E87-B68C-4E27-87AD-AEB589A30BAC

Nothing like what we're used to (google.com, 192.168.0.103, etc). Moreover, it uses a new, different host each time the Web Viewer is rendered. This is only for the Mac side.  On the PC, as evidenced by the fact that Google Maps worked, the host is blank as expected.

Consider the following HTML, which uses JavaScript to write the host:

<HTML>
<script type="text/javascript">document.write(location.host)</script>
</HTML>

 If you display that in the Web Viewer using a 'data:text/html' calculation:

"data:text/html," & "<HTML><script type=\"text/javascript\">document.write(location.host)</script></HTML>"

You should see what I'm talking about if you run this on a Mac. It's as simple as copying the above code and pasting it into a Web Viewer calculation on a Mac. Or, you can download a proof of concept file which demonstrates the behavior.

Note: I've looked quickly at the newly-released 10.0 version of FileMaker Pro and this behavior seems to persist.

I suspect that the reason there's a host here is that it has something to do with the way FileMaker is internally rendering that data:url page.  Perhaps it's running a single-instance, internal HTTP server (a host, as it were) each time a data:url is used.  When I get the ear of an engineer at FMI, perhaps we can know for sure.

In any case, stay tuned to the blog for a workaround for this on the Mac.  Hint: it involves using a host you can actually control.

Update: Cross Platform Solution

re:

Google enables users to search the Web, Usenet, and images. Please visit slideklip.com for more information.

Confirmed broken on FMP 11 Mac

Sigh,

Either FMI is still unaware of this, or they have reasons not to modify the default behaviour.

Either way, I just downloaded the proof of concept file, and it behaves exactly as described in my FMPA 11 on Mac OS X 10.6.3...

don't see the host on the pc either

I can't get your test for the host to work on the pc as well. I take your word for it but I wonder why? I have XAMPP running apache on my pc laptop wireless with Windows Vista 64 bit. I put the calculation in the custom web address like this:
"data:text/html,"&"data:text/html," & "document.write(location.host)"

I get a blank in the web viewer?I'm trying to understand this.

I had no idea that a web app

I had no idea that a web app could be computer specific. I thought the browser on the computer only displayed the page the server gave it. Ineteresting stuff.

Hint

I got it working running on the local web server (apache obviously). But the problem with that is the page becomes static, ie I need a way to query my page with postcodes (zipcodes) which is proving beyond my PHP/Javascript skills.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><p><div> <br><img>
  • Lines and paragraphs break automatically.

More information about formatting options

Verification
This question is for testing whether you are a human visitor and to prevent automated spam submissions.