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

Work on file:// URLs. #10

Closed
wants to merge 1 commit into from
Closed

Work on file:// URLs. #10

wants to merge 1 commit into from

Conversation

odensc
Copy link

@odensc odensc commented May 4, 2015

XHR requests for file:// URLs always return status 0.

XHR requests for file:// URLs always return status 0.
@matthewwithanm
Copy link
Collaborator

Hm, I'm going to have to think about this. Zero statuses are also used for a bunch of errors. I'm not sure how best to discern between a zero status that's an error and one that isn't (without using onload which isn't supported in older browsers).

@odensc
Copy link
Author

odensc commented May 4, 2015

Maybe we could check if it starts with "file://"? Or, is there a way I can tell onError that it's not an error and to continue in my code?

@odensc
Copy link
Author

odensc commented May 7, 2015

That seems to be working. Thanks! Could you update the httpplease version and publish?

@matthewwithanm
Copy link
Collaborator

Alright, I did a lot of thinking about this. IMO the issue is in httpplease; namely, it falsely identifies all 0 status responses as errors. Of course, you can't blame it too much; XHR's traditional means of checking for completion—onreadystatechange—falls down there. The only way to really know if it's an error is by using onerror. So that's what the new version does, if onerror is supported. If not, it'll fall back to the old behavior. That means that old browsers will still have the false errors, but I doubt that's an issue in practice.

@matthewwithanm
Copy link
Collaborator

Wow, you were fast! Yup, it's on its way (:

matthewwithanm added a commit that referenced this pull request May 7, 2015
@matthewwithanm
Copy link
Collaborator

Alright, 0.4.1 is up.

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

Successfully merging this pull request may close these issues.

2 participants