A user tries to navigate away from a page, either by following a link, or submitting a form.
I want to do some server-side validation on HTTP requests before I allow them to proceed. If validation fails, I want the user to stay on the same page and get some notification.
Can the server generate a response that will make the user stay on the same page?
For example, I was thinking to use a Content-Disposition: bogus
header to stay on the page (and a hack to get the validation failure), but apparently browsers try to save those responses to a file, as if the were attachment
, instead of ignoring them.
I can inject javascript into the web pages, but the page logic is a black box for me (I can't write client-side code that's specific to the logic). So, I can't reimplement forms and links on the page as AJAX calls.