There is no “web page” whose URL we can use for a location in a Deno process. We instead allow users to emulate a document location by specifying one on the CLI using the --location
flag. It can be a http
or https
URL.
Setting location
or any of its fields will normally cause navigation in browsers. This is not applicable in Deno, so it will throw in this situation.
Fetch API
The call above would throw if the --location
flag was not passed, since there is no web-analogous location to base it onto.
Worker modules
The flag is intended for those who have some specific purpose in mind for emulating a document location and are aware that this will only work at application-level. However, you may also use it to silence errors from a dependency which is frivolously accessing the location
global.