I am attempting to use JS Navigator from a Python script, running pyv8.
The error I am being hit with is:
ReferenceError: navigator is not defined
I have tried the same code in JSFiddle and it works great, I can only assume running the JS from a browser allows access to more functions that the V8 engine allows.
Unfortunately my knowledge of JS (and pretty much anything web!) is very limited, i'm sure this is a trivial question for anyone with web experience, would someone kindly explain fundamentally why this happens, and how can I can go about avoiding it?
EDIT
Trying to get the outputs from this JSFiddle.
And so far my Python code is:
import PyV8
ctxt = PyV8.JSContext()
ctxt.enter()
ctxt.eval("navigator.geolocation.getCurrentPosition();")
I'm certain theres problems with that aswell (i.e actually showing the values), however right now i'm more concerned about why navigator is undefined.
Off the bat I'd say that because you are not within a browser environment, there is no navigator
global property available.
You'll need to find another way to get geolocation information... possibly using a Python library?