如何使用 Apple Mapkit 在 Web Viewer 中使用 javascript 访问 filemaker 脚本?

问题描述 投票:0回答:1

我有一个使用 Apple Maps 的 Web Viewer 的 Filemaker 18。"+ long; window.location = theURL;2)var theURL ="fmnet: 问题是我无法触发该脚本。"+ long;window.location = theURL;3)var theURL = "window.location = "fmp: 我已经尝试了这3种方法,但我甚至无法运行一个简单的 "你好 "脚本。"+ long;window.location = theURL;

In fact I notice that when I have anything after showing a popup (then I want to run the script) the map is blank whatever I add like "alert("hello").

Here is my js file in Filemaker 18:

var message = document.getElementById("message");
var center = new mapkit.Coordinate(x,y); // 

mapkit.init({
    authorizationCallback: done => {
        done(
            "<<$$JWT.TOKEN>>"
        );
    }
});    //alert("<<$$JWT.TOKEN>>");

        var map = new mapkit.Map("map", { 
            showsScale: mapkit.FeatureVisibility.Visible,
            center: center
        });

        var marker = new mapkit.MarkerAnnotation(map.center, {
            draggable: true,
            selected: true,
            title: "Dra meg og slipp!"
        });
        marker.addEventListener("drag-start", function(event) {
            // No need to show "Drag me" message once user has dragged
            // event.target.title = "";
            // Hide message
            message.style.display = "none";
        });
        marker.addEventListener("drag-end", function() {
          // center map to marker when moved
            map.setCenterAnimated(marker.coordinate); 
          // hide message after seconds
            window.setTimeout(function () {
                message.style.display = "none";
            }, 3550);

          // message to show after move
            var lat     = marker.coordinate.latitude;
            var long    = marker.coordinate.longitude;
            var message = document.getElementById('message');
            message.innerHTML = "<p>Vi har lagret posisjonen</p>Latitude: " + lat + " <br />Longitude: " + long;
            message.style.display = "block";

//alert("Hello"); ** this alert works!! **
//var test = ‘Hello World!’; alert(test); ** this line gives me a blank map just adding a "var statement" **
var theURL = "fmp://$/" & Get ( FileName ) & "?script=Testaccess&param=" + lat +"|"+ long;  

        window.location = theURL;
// alert(theURL) here gives me blank map
        }); // END drag-end
        map.addAnnotation(marker); 


        var lat     = marker.coordinate.latitude;
        var long    = marker.coordinate.longitude;
        var borchbio = new mapkit.CoordinateRegion(
            new mapkit.Coordinate(lat,long),
            new mapkit.CoordinateSpan(0.002, 0.002)
        );

        map.region = mymap;
        map.mapType = "hybrid";map.setCenterAnimated(new mapkit.Coordinate(x,y), true); 
javascript mapkit filemaker
1个回答
1
投票

here. File-->Manage-->Security-->Advanced Settings-->Extended Privileges,Select fmurlscriptClick Edit,Add the Privilege set that is aligned to your Account Name to the selected fmurlscript

With this code I am able to run a FM script from javascript. Here is the code that triggers the script. Notice that when my database is "WEBMAP.fmp12" I only use "WEBMAP" as the name. I am sending the lat and long to the script that does stuff with it (converts it and writes to the post). The "fmp18: 以下是我尝试运行脚本的方法。我没有得到任何响应。

1)var theURL = "fmp:/$" & Get ( FileName ) & "?script=Hello&param=" + lat +"/ip_address_of_serverWEBMAP.fmp12?script=Hello&param=" + lat +"/$WEBMAP.fmp12?script=Hello&param=" + lat +"/"目标是特定的18版本。

  var theURL = "fmp18://$/WEBMAP?script=My_FM_Script_Name&param=" + lat +"|"+ long;
  window.location = theURL;
© www.soinside.com 2019 - 2024. All rights reserved.