What HTTP status code should I return that tells the browser to stay on the current page?

I have a table with a lot of shared link from the database.

Now the client wants to bind certain types (or show). Changing the page that makes the links is very difficult, so I want to show some kind of warning to the user, but it would be ideal for the browser to stay on the page, instead of navigating to a blank one and forcing the user o to press back.

Is there an HTTP status code that tells the browser to stay on the current page?

+4
source share
1 answer

You can try with 204 No Content

See HTTP RFC

If the client is a user agent, it MUST NOT change the appearance of the document from what caused the request to be sent. This answer is primarily intended to be entered without changing the active viewing of the user's agent document, although any new or updated meta-information MUST use the document currently held by the user of the active agent.

+8
source

Source: https://habr.com/ru/post/1303048/


All Articles