Hi Stephen, thanks for your input.
Yes, I think it would be wise to propose something like
"replaceLocation" as an addition to the proxy interface.
Following your suggestions, I was able to come up with a working
solution (adding a function called replaceLocation to the HistoryProxy
and just manually calling it right before the redirect -- obviously a
more ideal solution would be to have it passed-through the app or
automatically called in redirect like you said... but didn't want to
monkey with Sammy internals too much).
var proxy = new HistoryLocationProxy(this);
this.setLocationProxy(proxy);
...
$.get('#/page1', function(context){
var page = "#/page2";
proxy.replaceLocation(page);
context.redirect(page);
});
Thanks for the help!
> I agree, the Sammy *redirect* does seem broken--its behaves more like a *
> forward--*I've been meaning to propose a change for this. To get the correct
> behaviour, you do need to alter the HashLocationProxy, *setLocation* can be
> changed from:
>
> setLocation: function(new_location) {
> return (window.location = new_location);
> }
>
> to:
>
> setLocation: function(new_location) {
> return window.location.replace(new_location);
> }
>
> However this would most probably have unwanted side effects, so it may be
> wiser to create a new function *replaceLocation* and alter *redirect* to
> call this instead. Additionally I would create a counterpart to *redirect*
> called *forward,* which would function exactly as the current
> *redirect*does now.
>
> Not a complete solution but a start...
>
> .Steve
>