Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor simulate back button #12838

Closed
Yen opened this issue Aug 2, 2019 · 3 comments
Closed

Blazor simulate back button #12838

Yen opened this issue Aug 2, 2019 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components question

Comments

@Yen
Copy link

Yen commented Aug 2, 2019

I am trying to build a "confirm action" page and would to have a cancel button that goes back in the navigation stack rather than pushing a new redirect to the previous page. This is because if someone was to then go back in the browser it will redirect them back to the confirm.

I don't understand how, if possible, to use IUriHelper to perform this action.

I would like some way of using the IUriHelper to "navigate back" rather than forwards to a new page, this is how to have correct back button semantics with native back buttons. Thanks.

(I am using blazor server side)

@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Aug 2, 2019
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @Yen .
You can use JSInterop to directly call the window.back() method.

@Yen
Copy link
Author

Yen commented Aug 2, 2019

Thanks for responding. I understand I can manually call the browser history API to perform this action, but this is not really correct due to this being a work around for an implementation detail. (IUriHelper is the interface for which the implementation could or could not use the browser history API.)

Is there no intent to support popping the navigation stack in blazor?

@mkArtakMSFT
Copy link
Member

We don't have any immediate plans for that:

Is there no intent to support popping the navigation stack in blazor?

@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components question
Projects
None yet
Development

No branches or pull requests

2 participants