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

Relative URLs falling back to "localhost" and no port instead of the window.location.host/port in v1.0.6 -- Browserify build #28

Closed
joeldouglass opened this issue Sep 14, 2017 · 2 comments

Comments

@joeldouglass
Copy link

As of 1.0.6, requesting a relative URL no longer seems to work correctly. At least this is the case when building with Browserify...

For example, if I'm hosting a dev site at: http://mydevsite:8888 and try something like d3.csv('/data.csv') a request will be made to http://localhost/data.csv instead of http://mydevsite:8888/data.csv'.

Steps to reproduce:

  1. npm install -g browserify
  2. In a clean folder, create an index.html file:
<html>
  <head>
    <script src="/generated.js"></script>
  </head>
  <body></body>
</html>
  1. Create an index.js file:
const {csv} = require('d3-request');
csv('/test.csv', console.log);
  1. Create a sample test.csv file

  2. npm install d3-request@1.0.5

  3. browserify index.js -o generated.js

  4. python -m SimpleHTTPServer 8888

  5. Open up in a browser (use http://127.0.0.1:8888) and verify that the csv file is properly requested at http://127.0.0.1:8888/test.csv

  6. Next: npm install d3-request@1.0.6 and repeat steps 6-8

  7. See that the the requested path is: http://localhost/test.csv

@mbostock
Copy link
Member

Duplicate of #24.

@bhagyas
Copy link

bhagyas commented Feb 18, 2019

This seems to be an issue with browsers, I have reported this at Chrome.

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

No branches or pull requests

3 participants