IE9错误navigator.geolocation返回undefined [英] IE9 error navigator.geolocation returns undefined
问题描述
在我的浏览器(IE9)中,一些包含地理定位(HTML5)的网站正常运行。
In my browser (IE9) , some sites which includes geolocation (HTML5) are working properly.
我继续尝试此功能。我做了一个简单的html页面,但navigator.geolocation未定义。
I went ahead and tried this feature myself. I made a simple html page, but navigator.geolocation is coming undefined.
  ;         if(navigator.geolocation == undefined)
if(navigator.geolocation==undefined)
        {
{
          提示("未定义");
alert("Not defined");
        }
}
当我尝试调试代码时,有一种有趣的情况,当我在导航器对象上添加一个监视时,它会将地理位置显示为属性,但是当我在navigator.geolocation上添加监视时它说未定义。我无法理解这种奇怪的
行为的原因。(我已经检查过,代码中没有输入错误。)
When I tried to debug the code, there is interesting situation, when i add a watch on navigator object, it shows geolocation as a property, but when i add watch on navigator.geolocation it says undefined. I can't understand the reason for this strange behaviour. (I've checked and there is no typing mistake in the code .)
       任何帮助都将非常感激。
Any Help will be really appreciated.
谢谢,
Jitendra Gupta ;
Jitendra Gupta
推荐答案
有趣的是,当文件(location.htm)在本地计算机上时,它可以正常工作,但是当我将它放在网络上的共享位置并尝试运行它时同样的错误发生。
Interestingly it works when the file (location.htm) is on local machine, but when i place it on shared location on network and try to run it same error occurs.
任何帮助?
谢谢,
这篇关于IE9错误navigator.geolocation返回undefined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!