Jump to content

  •  

Photo

Web Viewer + Location Service


  • Please log in to reply
8 replies to this topic

#1 laurentades  member

laurentades
  • Members
  • 7 posts
  • FM Application:12 Advance
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 8h 4m 8s

Posted 21 June 2014 - 12:14 AM

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>
"
 
 

  • 0

#2 No_access  ITM

No_access
  • Members
  • 236 posts
  • LocationPittsburgh PA
  • FM Application:11 Advance
  • Platform:Windows XP
  • Skill Level:Expert
  • Membership:TechNet
  • Time Online: 5d 3h 6m 46s

Posted 26 June 2014 - 09:33 AM

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


  • 1

#3 laurentades  member

laurentades
  • Members
  • 7 posts
  • FM Application:12 Advance
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 8h 4m 8s

Posted 26 June 2014 - 10:14 PM

Yes please!


  • 0

#4 laurentades  member

laurentades
  • Members
  • 7 posts
  • FM Application:12 Advance
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 8h 4m 8s

Posted 26 June 2014 - 10:26 PM

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 ?


  • 0

#5 No_access  ITM

No_access
  • Members
  • 236 posts
  • LocationPittsburgh PA
  • FM Application:11 Advance
  • Platform:Windows XP
  • Skill Level:Expert
  • Membership:TechNet
  • Time Online: 5d 3h 6m 46s

Posted 27 June 2014 - 03:37 AM

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


  • 0

#6 laurentades  member

laurentades
  • Members
  • 7 posts
  • FM Application:12 Advance
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 8h 4m 8s

Posted 29 June 2014 - 11:35 PM

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....


  • 0

#7 No_access  ITM

No_access
  • Members
  • 236 posts
  • LocationPittsburgh PA
  • FM Application:11 Advance
  • Platform:Windows XP
  • Skill Level:Expert
  • Membership:TechNet
  • Time Online: 5d 3h 6m 46s

Posted 07 July 2014 - 12:33 PM

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.


  • 0

#8 laurentades  member

laurentades
  • Members
  • 7 posts
  • FM Application:12 Advance
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 8h 4m 8s

Posted 11 July 2014 - 05:51 AM

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.


  • 0

#9 laurentades  member

laurentades
  • Members
  • 7 posts
  • FM Application:12 Advance
  • Platform:Mac OS X Mountain Lion
  • Skill Level:Intermediate
  • Membership:TechNet
  • Time Online: 8h 4m 8s

Posted 12 September 2014 - 12:42 AM

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!


  • 0




FMForum Advertisers