I'm wanting to have a simple cancel button so on confirmation of, say, the deletion of a product, they can change their mind and click cancel before the actual delete action is started.
I figure that on clicking the button you are wanting to redirect the user to the previous page. I understand that a common way to handle this is with javascript
onclick="javascript:history.back(1);"
Is this acceptable? If the user has javascript disabled, what happens then?
So instead, I figured that I would submit the form and an action would redirect the user to the previous page. Is this how it should be done? And if so, what is the C# code to do this?
Thanks for any help :)
the only way you can do this without javascript is if you make a second form that POSTs to a different action (that will just redirect you) that just has a single submit button with cancel text.
If you are doing a web application, it is pretty much expected that javascript is a requirement. As far as I'm concerned, anyone who chooses to live without javascript nowadays is choosing to live with a broken internet, and it has been a very long time since browsers did not support it. The whole idea is just silly to me, sort of like the people who block cookies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With