JQuery Address Remove Last URL From History

We use the jQuery Address plugin in our ASP.NET MVC ajax application to handle deep links and save history. Whenever you want to go to a new page, you simply call the following call:

$.address.value([some url])

Our application has a very detailed user management system that allows our users to determine which users have access to which functions in the application. We decorate each action method with a custom Authorize attribute, which determines whether the user has permission to use the function provided by this action method. Authorization works fine, but the problem is that if the user does not have permission to use this method of action, the browser URL still reflects that they are on the link page that they clicked.

For example, if url / SomeController / UnpermittedAction is an action method that the user cannot use when he clicks the link to this method, we do the following

$.address.value('/SomeController/UnpermittedAction')

Then the action returns an unauthorized response, and we show the user that they are not allowed to use this function. But, of course, the user's browser window now shows:

somedomain.com/#/SomeController/UnpermittedAction

This in itself is not a problem, the problem is that if the user goes to another page and then clicks the back button of the browser, they again see an unauthorized message, and this looks somewhat confusing, because they are not why they see this message. Ideally, if they click the back button, we would like to return the user to the last page that they allowed to use.

My question is, is there a way to remove an unused action URL from the browser history and / or jQuery address history?

+3
source share
1

javascript try

        $.address.history(false);
        $.address.value(newurl);
        $.address.history(true);

URL

0

All Articles