Skip to content Skip to sidebar Skip to footer

Uncaught Typeerror: Illegal Invocation In Javascript (geolocation)

I am getting the Javascript error 'Uncaught TypeError: Illegal invocation' when running the code var nativeGeoloation = window.navigator.geolocation.getCurrentPosition; nativeGeolo

Solution 1:

The error I'm getting in Firefox is:

TypeError: 'getCurrentPosition' called on an object that does not implement interface Geolocation.

Change your code to:

var nativeGeoloation = window.navigator.geolocation;
nativeGeoloation.getCurrentPosition(function (){ alert("ok")});

(Note, you've also spelled nativeGeoloation incorrectly which might cause you problems down the road if you start to spell it correctly).

DEMO

Post a Comment for "Uncaught Typeerror: Illegal Invocation In Javascript (geolocation)"