Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.location #1750

Closed
ry opened this issue Feb 12, 2019 · 3 comments
Closed

window.location #1750

ry opened this issue Feb 12, 2019 · 3 comments
Milestone

Comments

@ry
Copy link
Member

ry commented Feb 12, 2019

If a deno program is executed with a local path (as opposed to a remote URL), the window.location should resolve to specified file.

Say we have foo.js in the directory /Users/rld/src/deno/ and suppose it's also uploaded to https://example.com/foo.js

// foo.js
import 'bar.js'
console.log("foo", window.location.toString());

and that we also have bar.js that lives besides foo.js locally and remotely:

// bar.js
console.log("bar", window.location.toString());

Then we should get the following:

> deno example.js
foo file:///Users/rld/src/deno/foo.js
bar file:///Users/rld/src/deno/foo.js

> deno https://example.com/foo.js
foo https://example.com/foo.js
bar https://example.com/foo.js

(See the discussion in #203)

@bartlomieju
Copy link
Member

Ref #1189

@ry ry added this to the v0.4 milestone Feb 12, 2019
@kitsonk
Copy link
Contributor

kitsonk commented Feb 12, 2019

FYI, this is on my backlog.

@thgh
Copy link
Contributor

thgh commented Feb 13, 2019

Note: the foo.js example does not work in browsers:
Chrome: Uncaught TypeError: Failed to resolve module specifier "bar.js". Relative references must start with either "/", "./", or "../".
Firefox: TypeError: Error resolving module specifier: bar.js
Safari: TypeError: Module specifier does not start with "/", "./", or "../".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants