Filemaker - 通过网络查看器向 GoogleMaps API v3 中的信息窗口添加按钮以更改布局

Filemaker - Adding a button to infoWindow in GoogleMaps API v3 via web viewer to change layout

我四处寻找这个问题的答案,但还是卡住了。我想要做的是使用 Google Maps API v3.

将地图填充到 Webviewer 中

我填充了一个标记,单击该标记后,会显示一个信息窗口。在 infoWindow 中,有一个按钮可以用来(希望)实现我的目标。

在这一点上,我根本无法从按钮中得到任何东西。我曾尝试使用对与此类似的问题的回答,但我没有运气。我还需要知道我是否可以直接从 Web 查看器浏览布局并再次返回。

即我想要一张地图来显示,其中填充了 10 公里半径内所有客户的标记。然后我希望 infoWindow 显示客户信息,例如姓名地址和其他相关信息。我能做的所有这些(大部分)然而,我需要完成的是该信息 window 中的按钮或 link,单击该按钮时将导航到文件制作器中的另一个布局以显示该客户记录。

这真的可以实现吗?如果是这样,我该怎么做?

我已经包含了当前版本的代码。

    <!DOCTYPE html>
<html>
  <head>
    <style type="text/css">
      html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
    </style>
    <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=USING VALID API KEY HERE">
    </script>
    <script type="text/javascript">
      function initialize() {
  var myLatlng = new google.maps.LatLng(-34.397,150.644);
  var mapOptions = {
    zoom: 4,
    center: myLatlng
  }
  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  var contentString = '<div id="content">'+
      '<div id="siteNotice">'+
      '</div>'+
      '<h1 id="firstHeading" class="firstHeading">Tony McShane</h1>'+
      '<div id="bodyContent">'+
      '<p><b>TONY</b>, also referred to as <b>Epic Douchebag</b>, is a dude from cranny' +
      '</p>'+
      '<div id="button_div" style="text-align:centre">'+
      '<button id="myBtn" onclick="<a href=FMP://www.myURLhere.com/iCOMPLI%20Auditor%20_Tenancy%20Lite%20Metcash%20upgrade.fmp12?script=goto_iCompli%20Map%20Info%20Window%20Button%20Click%20TEST type="button">Click Me!</button>'+
      '</div>'+
      '</div>'+
      '</div>';

  var infowindow = new google.maps.InfoWindow({
      content: contentString

  });

  var marker = new google.maps.Marker({
      position: myLatlng,
      map: map,
      title: 'Tony McShane, You Have Failed This Database'
  });
   google.maps.event.addListener(marker, 'click', function() {
    infowindow.open(map,marker);
  });

}

}

google.maps.event.addDomListener(window, 'load', initialize);

google.maps.event.addListener(infowindow, 'domready', function() {
      google.maps.event.addDomListener(myBtn, 'click', function() {

        alert("THIS WORKED");
      });
    });


    </script>

  </head>
  <body>
<div id="map-canvas"></div>
  </body>
</html>
</script>
  </head>
  <body>
<div id="map-canvas"></div>
  </body>
</html>

是的,这是很好的支持。您缺少的部分是 the fmp:// protocol,它充当 Web 查看器和本机 FileMaker 之间的桥梁。这允许直接从您的 JavaScript 代码调用 FileMaker 脚本。

在您的 JavaScript 中(无论您想要调用 FileMaker 脚本的什么地方),您将 Web 查看器的位置 属性 设置为有效的 fmp url。 fmp 协议允许您指定要调用的脚本和参数传递。一旦有效设置,这将非常有效。这是 detailed overview of how to set this up.