Facebook Messenger内部浏览器和GPS

时间:2018-05-24 14:00:48

标签: javascript facebook gps

我通过Facebook Messenger发送链接到网页,网页步伐包括GPS代码 该代码在chrome中很有用,但在Facebook内部浏览器上却没有。 问题是什么?

function getLocation() {
                    if (navigator.geolocation) {
                        navigator.geolocation.getCurrentPosition(showPosition);
                    } else { 
                        x.innerHTML = "<!-- Geolocation is not supported by this browser -->";
                    }

                }
                function showPosition(position) {

                if ( ( Math.abs(position.coords.latitude -<?php echo $lat ?>) >0.0001)|| ( Math.abs(position.coords.longitude -<?php echo $lon ?>) >0.0001)){
                    window.location  = ( "/show/?lat=" + position.coords.latitude + 
                    "&lon=" + position.coords.longitude);

                    }
                }
                getLocation(); 

0 个答案:

没有答案