Selasa, 09 April 2024

Web Page Process

 A Web Page load from a browser is usually a 4 step process (not considering redirections):

  1. Browser sends HTTP Request, when the Server is available.
  2. Server executes code (for dynamic pages).
  3. Server sends the HTTP Response (usually HTML).
  4. Browser renders HTML, and asks for other files (images, css, etc).

The browser reaction to "Stop" depends on the step your request is at that time:

  • If your server is slow or overloaded, and you hit "Stop" during step 1, nothing happens. The browser doesn't send the request message.
  • Most of the times, however, "Stop" will be hit on steps 2, 3 and 4, and in those steps your code is already executed, the browser simply stops waiting for the response (2), or receiving the response (3), or rendering the response (4).
  • The HTTP call itself is always a 2 steps action (Request/Response), and there is no automatic way to rollback the execution from the client.

"Server Script", e.g. PHP internally maintains a status of the connection to the client. The possible values are NORMAL, ABORTED and TIMEOUT. While the connection status is NORMAL, the script will continue to execute as expected.

If the user clicks the Stop button in their browser, the connection is typically closed by the client and the status changes to ABORTED. A change of status to ABORTED will immediately end / terminated execution of the running script. 

As an aside, the same thing happens when the status changes to TIMEOUT ("Server Script's" setting for the allowed run-time of scripts is exceeded).

Bibliography:

https://stackoverflow.com/

https://www.php.net/

https://docs.oracle.com/

https://nodejs.org/

Related Post:

List All Enabled PHP Extension
Hello World PHP XAMPP
How To Check PHP Version
URL Address PHP MySQL Local Server 2
URL Address PHP MySQL Local Server 1
PHP Bind Param
Memelihara Kesehatan Lingkungan


Tidak ada komentar:

Posting Komentar

Various Other Posts