Jump to content

Web Viewer + Location Service


This topic is 3485 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello,

 

I need to add geo location capabilities to a solution hosted on FMS13 that should be able to run on FMGo, FMPro or Webdirect. As this is not only FMGo, i tried replicating the GeoLocation WebViewer trick we all hear about when FMGo 12 was not yet out with native location function.

 

I have added the code below to a web viewer on a layout.

 

When opening on FMGo, it works a snap : i can get my location data. Therefore, the old trick still seems to be working. But when i open on FMPro (Mac OS 10.9), i get the  "Cant get located" error which seems to tell me that the WebViewer is not getting to the location service.

 

Any idea ?

 

Thanks

 

 

"data:text/html,
<html>
    <head>
        <script type='text/javascript'>
 
            function handler(location) {
                var messageArea = document.getElementById('messageArea');
                messageArea.innerHTML='<p>Latitude: ' + location.coords.latitude + '</p>';
                messageArea.innerHTML+='<p>Longitude: ' + location.coords.longitude + '</p>';
                messageArea.innerHTML+='<p>Accuracy: ' + location.coords.accuracy + '</p>';
            }
            
            function fail() { 
                var messageArea = document.getElementById('messageArea');
                messageArea.innerHTML='<p>Cant get located</p>'
            }
            
            function getLocation() {
                navigator.geolocation.watchPosition(handler,fail,{maximumAge: 5000, enableHighAccuracy: true, timeout: 30000});
            }
            
        </script> 
    </head>
 
    <body onload='getLocation();'>
        <div id='messageArea'>
            Location unknown 
        </div>
    </body>
 
</html>
"
 
 
Link to comment
Share on other sites

I believe the issue is with the browser not have the proper handle needed for this function. You can use google api to easily get lat/long if you want to try it I can post the code

  • Like 1
Link to comment
Share on other sites

Funny however that it would be a matte of browser : this code works fine when opened with Safari, which is - officially - the browser engine used by FMP to render web viewers on OS X.

I see you are Windows. Same issue with Internet Explorer engine ?

Link to comment
Share on other sites

Yeah, IE has issues.

Obviously using google  you need to enter some amount of data, their are a couple ways of getting lat/lon. 1 is using ip address  another way is by zip code. or by actual address which is the most accurate.  so the questions becomes then? how to you want to do it. code is different for each. 

If your users could you go. that would solve your problems. if you are looking to map  latitude and longitudes, thats easy .  really depends on what you need. for example if you were using it for geocaching then this would not be the technique for you.,

let me know and I will give you all the help I can

thanks

Link to comment
Share on other sites

hmmm.... well, this is getting tricky now : the users will not be able to input any of these info... so unless the google service has the ability to work out the location from the client's data it will not be very helpful.

 

The beauty of the code i posted up there is that it seems to use the client machine OS built in location service to do its magic... And ideally, i'd rather find a way to solve what appears to be either a bug or something missing in the code to make it work : this code works on Safari on a Mac and on an iPad in the web viewer but not on FMP web viewer : therefore it look like something is not cooking with FMP's web viewer itself or in the way it leverages Safari's API. Hence my question on IE/Windows....

Link to comment
Share on other sites

Actually you can use IP Address... Remember geo location requires some type of information, so if you are on on iPhone. the phone can triangulate your position pretty accurately using cell towers.

if you are on an apple laptop.  that is not hooked to a cell tower. only wifi... what information do you think it uses.  ip address is the information that is available to the program. and can be gotten easily without user input.. how accurate is that  hmm. that city I would assume... in my case. the ip address on a map is 4.2 miles from my actual location.

it depends on what you need it for.  there are a lot of ways to  "skin the cat" as they say.

tell me how accurate you need to be and I will try and find a way for you to do it.

Link to comment
Share on other sites

Well, 4.2 miles is not a negligible difference.... I'm happy to handle a couple hundred meters but more than half a mile will be an issue.

 

One thing still tickles me : still don't understand why the code above works on Safari app on the Mac but won't work in the FM WebViewer on the very same machine at same time.

Link to comment
Share on other sites

  • 2 months later...

By the way, FileMaker support confirms that FileMaker Pro WebViewer on Mac appears to be limited due to OS level restrictions. And guess what, as the OS is Apple an not them, they can't do anything about it....

 

Quite funny... its not like these 2 companies don't know each other an FIleMaker even boasts about being 100% owned by Apple.... However, none can talk to their counterpart to fix the stupid issue... and the customer is held ransom... Great!

Link to comment
Share on other sites

This topic is 3485 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.