Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between reload and refresh

What is the difference between reload in JS

    location.reload();

and refresh in PHP

    header("Refresh:0");
like image 311
SP_ Avatar asked Jul 15 '26 06:07

SP_


1 Answers

From W3Schools:

The reload() method is used to reload the current document. The reload() method does the same as the reload button in your browser. By default, the reload() method reloads the page from the cache, but you can force it to reload the page from the server by setting the forceGet parameter to true:

location.reload(true)

header("Refresh:0"); do the same as reload() (refresh current page). You can also set time interval and location for refresh.

header("Refresh:0; url=page2.php");

it will now refresh from page2.php

like image 172
Emdadul Sawon Avatar answered Jul 21 '26 15:07

Emdadul Sawon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!