Backbone.js save current URL to history
I'm trying to save my application's current url / url fragment to my
browser's history without necessarily knowing what that url is in my code.
Specifically, the page I'm creating allows the user to search records.
When they submit the search, I'm updating the URL with a query string
containing their search options, but NOT saving the new URL to the
history. This is that line of code:
Backbone.history.navigate(this.getQueryString(options), { trigger: false,
replace: true });
(I'm doing it this way so that users don't have to iterate back through
previous searches to get to the page they were on before.)
Now, when the user double clicks on a record, I want to navigate to a page
with that records details, but I want to save the url querystring of their
last search so that they can return to it. (I've rigged my router to read
querystrings and it works correctly.)
Ideally I'd like to just save the current url without having to know it.
If that won't work, how can I find the current url/url fragment to do
something like: Backbone.history.navigate(currentURL, {trigger: false});
No comments:
Post a Comment