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

(Broken as cordova/phonegap app) When running through file protocol router does not remove three slashes and incorrectly route matches #2639

Closed
jdinard opened this issue Dec 3, 2015 · 3 comments

Comments

@jdinard
Copy link

jdinard commented Dec 3, 2015

The router can't handle anything run over a local file protocol.

It interprets the third slash after file:// as a route.

So if you create an app and try to run it from file:///C:/myapp.html

It thinks you are attempting to access the route /C:/myapp.html and throws an error saying

"Warning: Location "/C:/myapp.html" does not match any routes.

This is incorrect behavior and breaks the router on stuff like phonegap.

@jdinard jdinard changed the title When running through file protocol router does not remove three slashes and incorrectly attempts to route match (Broken as cordova/phonegap app) When running through file protocol router does not remove three slashes and incorrectly attempts to route match Dec 3, 2015
@jdinard jdinard changed the title (Broken as cordova/phonegap app) When running through file protocol router does not remove three slashes and incorrectly attempts to route match (Broken as cordova/phonegap app) When running through file protocol router does not remove three slashes and incorrectly route matches Dec 3, 2015
@taion
Copy link
Contributor

taion commented Dec 4, 2015

Thanks for your question!

We want to make sure that the GitHub issue tracker remains the best place to track bug reports and feature requests that affect the development of React Router.

Questions like yours deserve a purpose-built Q&A forum. Would you like to post this question to Stack Overflow with the tag #react-router? https://stackoverflow.com/questions/ask?tags=react-router.

We also have an active and helpful React Router community on Reactiflux, which is a great place to get fast help with React Router and with the rest of the React ecosystem. You can join at https://discord.gg/0ZcbPKXt5bYaNQ46.

@taion taion closed this as completed Dec 4, 2015
@richardardrichard
Copy link

I had this same issue. I got around it by using hash history, instead of push state.

import createHistory from 'history/lib/createHashHistory'
export default createHistory()

@jarrodmedrano
Copy link

This is still an issue.
When I build my react router project and open the index.html in IE edge, I get file:///C:/C:/
In chrome canary, the routing works fine.

I am using hashHistory as explained above.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants