Home > OS >  Using Google Maps JavaScript API with map in iFrame
Using Google Maps JavaScript API with map in iFrame

Time:09-28

I coded a very simple Web tool that allows me to retrieve the latitude/longitude of a location clicked in Google Maps by a user.

I coded this tool with the Google Maps JavaScript API. It works very well on my computer or on a typical Web server.

It's a bit complicated to explain, but my tool "runs" inside a software called FileMaker (by Claris, a subsidiary of Apple). Unfortunately, FileMaker displays the HTML code via an iFrame (I can't do anything about that, it's a limitation of FileMaker). Google does not seem to allow to use the JavaScript API if the Web page is displayed in an iFrame.

I know Google offers an API to display a simple map via an iFrame, but that's not enough for me (I think). I need to be able to add listener for various events, etc...

Is there any way to use the Google Maps JavaScript API if the result is displayed through an iFrame?

CodePudding user response:

Afternoon. It might work for you to encode the code you've gotten as base64. like this. However you are working with the code, wrap your code in the base64 function with the base64 data type prefix. This sample comes from my implementation of Google Maps:

Case ( 
  PatternCount ( Get ( ApplicationVersion ) ; "Web" ) ;
  "data:text/html;base64," & Base64Encode ( HTML::HTML_Calc_Here ) ;
  "data:text/html," & HTML::HTML_Calc_Here
)

I got this from here: https://www.soliantconsulting.com/blog/display-complex-webviewer-webdirect/

It talks about WebDirect, but it think the method still applies.

What version of FileMaker are you using?

I'm a bit surprised it's not working. I do have an (old) implementation of working with Google Maps to plot markers. Not sure if it's using the same as the geolocation. Maybe your API is different. Anyway. try the above and see if that works.

  • Related