Deno claims to be browser-compatible. Does that mean it has a window / navigator object and what would that mean in terms of things like setting window.location?
1 Answers
The global object in Deno is currently just called window
(and globalThis
due to upcoming ES standards, sadly). There is currently no navigator
/window.location
implemented.
The browser-compatible aspects of Deno are aiming to parts that are reasonable to exist even without under the browser environment, e.g. Event
, TextEncoder
, fetch
, etc. It would be an unnecessary burden to implement things like the complete DOM in the Deno core, and such tasks should be delegated to third-party modules (like JSDOM if ported to Deno)
Update: window.location
is added in Deno v0.3.0, pointing to the entry file's path (remote or local) (see usage in https://github.com/denoland/deno/issues/1750 , could be useful to implement something similar to Python's if __name__ == "__main__"

- 2,532
- 1
- 16
- 26
-
3`window.location` was removed before 1.0: https://github.com/denoland/deno/issues/3520 – jsejcksn May 24 '20 at 07:13
-
1having `window` object in server-side seems weird. – Sisir Sep 09 '21 at 07:26