I just looked at the same issue inside Overflow7
I decided to handle this in C # and not in Javascript. Basically, on my page, I added a Uri's stack:
private Stack<Uri> NavigationStack = new Stack<Uri>();
then I intercepted the navigational event of the web browser:
void TheWebBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { NavigationStack.Push(e.Uri); }
and then on the back button, press the override button. I am trying to navigate using the back button if I can:
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) { if (NavigationStack.Count > 1) {
Please note that this solution does not work perfectly with supervision, not with ajax sites, but overall it works very well.
Stuart
source share