Skip to content

Router without address bar #789

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

Closed
kirill-konshin opened this issue Feb 8, 2015 · 5 comments
Closed

Router without address bar #789

kirill-konshin opened this issue Feb 8, 2015 · 5 comments

Comments

@kirill-konshin
Copy link
Contributor

Is there a way to prevent Router from modifications of browser's address bar?

For example, angular-ui-router can run in an entirely isolated mode, so that you still can use states and transitions between them, but address bar stays untouched. Works well for widget-like components, that are installed somewhere in the page and should not modify neither path nor hash.

As far as I can see from docs and code, there are options: HashLocation, HistoryLocation, RefreshLocation. There is also TestLocation -- will it fit in this above mentioned use-case? Unfortunately it's not included in the build...

@basham
Copy link

basham commented Feb 9, 2015

Likewise pondering this situation. I suspect I'll have to create a custom Location object. But I'd really prefer to have such a thing officially supported.

@mjackson
Copy link
Member

In web applications, the address bar is the only piece of state we have to determine what we're going to show on the page. That's why URLs are absolutely essential to the design and function of react-router.

If you're switching some piece of UI but not reflecting the change in the URL, you still need to store that state somewhere, probably either in memory (in this.state of some component), window.localStorage, a cookie, etc.

We don't support this in the router right now, but I think #828 may be related. Being able to store/retrieve application state from somewhere other than the URL may be something we want to support in the future.

@basham
Copy link

basham commented Feb 14, 2015

As much as I can, I'd like my router state reflected in the URL. However, in my case, I'm hoping for state to be retained internally somewhere. Like @kirill-konshin, I'm building a small piece of a larger interface. Until react-router controls all parts of the UI, not just a portion, I'd prefer to retain the router state elsewhere, where it doesn't assume it owns the URL. As is, it could potentially cause conflicts in other parts of the non-React/react-router app. Looking forward to if #828 could solve this. Thanks.

@kirill-konshin
Copy link
Contributor Author

It seems that TestLocation works just fine. But I can't use it in my other project, that is not CommonJS based... So I've created a small PR where TestLocation is added to list of exports.

@ryanflorence
Copy link
Member

we now have MemoryLocation in 1.0

@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 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