Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have a table with lots of generic link from a DB.

Now the customer wants to restrict certain types to be linked (or showed). Changing the page that makes the links is very hard, so I want to show some alert to user but would be ideal that the browser stays in the page, instead of navigation to an empty one and force the user o press back.

Is there a HTTP status code that tells the browser to stay in the current page?

like image 696
Eduardo Molteni Avatar asked Mar 03 '10 20:03

Eduardo Molteni


People also ask

Should post return 200 or 201?

The POST method is used to send data to the server. Perhaps the most common status code returned is 200. It simply means that the request was received, understood, and is being processed, whereas the 201 status code indicates that a request was successful and a resource was created as a result. 1.

What does HTTP Status 200 mean?

The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default. The meaning of a success depends on the HTTP request method: GET : The resource has been fetched and is transmitted in the message body.

What status code is returned by a website when the browser?

Servers return a 500 HTTP status when the browser makes a valid request, but an internal error in the server prevents it from returning the page.

What is a 201 status code?

The HTTP 201 Created success status response code indicates that the request has succeeded and has led to the creation of a resource.


1 Answers

You could try with 204 No Content

See the HTTP RFC

If the client is a user agent, it SHOULD NOT change its document view from that which caused the request to be sent. This response is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent's active view.

like image 105
Ikke Avatar answered Nov 15 '22 04:11

Ikke