If a user navigates to a page 开发者_StackOverflow中文版that displays an "add item" view (#/items/add), I want to basically skip that url when they click "back" after they save the item.
How can I do this?
Here is the behavior I'm after in more detail... if the user has navigated to and is currently on this silverlight url:
#/items/list
when they click the "add" button...they are navigated to
#/items/add
after they save, they are navigated to
#/items/99 (where 99 is the new item id.)
When they click the back button from here, I want them to arrive back at
#/items/list
I was able to skip a particular url by handling the Navigating event of the Frame and doing something like this in the body of the handler:
if (SomehowDecideToSkipThisOne(e))
{
e.Cancel = true;
Frame.StopLoading();
Frame.Navigate(uriToRedirectTo);
}
However, the problem lies in how to implement SomehowDecideToSkipThisOne because according to MSDN, "Any navigation request that the user initiates through a Web browser (including using the back or forward button of the Web browser) is represented as a New type of navigation."
Therefore, I can't know when the user is actually going "back" when they click the back button on their browser. So, now I think I will decide to skip the usage of this feature especially since I don't need it for SEO. I just thought it would just be a nice enhancement for my intranet app. It's too hard to support properly though in this scenario.
精彩评论