Why location.reload() is slower than the other page reload methods?

Few months ago I posted this answer about how to refresh the page via JavaScript.

I provided a JSFIDDLE DEMO too:

var solutions = [
    function () { location.reload(); },
    function () { history.go(0); },
    function () { location.href = location.href; },
    function () { location.href = location.pathname; },
    function () { location.replace(location.pathname); },
    function () { location.reload(false); },

$("[data-func]").on("click", function () {

Someone noticed that location.reload() is slower than the other methos. Now I can see the same thing.

Why is it slower? Why the others are faster?



Been looking for this myself and the best reference I could find is actually on w3schools.com




false - Default. Reloads the current page from the cache.

true - The current page must be reloaded from the server


From the Mozilla Developement Network I guess the .reload method may fetch all files from the Server again. This would be similar to a CTRL + F5 reload.

The location.href for example, simply follows the link which may be cached. As for the MDN definition the behave is not clearly defined so I guess its browser and case specific behave.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.