What is the difference between an F5 (refresh) of a page and pasting that URL in a new window?

前端 未结 5 1471
不知归路
不知归路 2020-12-29 04:22

What is the difference between an F5 (refresh) of a page and pasting that URL in a new window and clicking enter?

Any help is appreciated

相关标签:
5条回答
  • 2020-12-29 05:02

    Refreshing a page does NOT explicitly refresh your cache. It will do a fresh GET, but anything cached stays cached. If you hit CTRL-F5, however, you'll refresh with a cache.

    Copy and pasting will just get another fresh copy of the site with a GET, not ignoring cache.

    0 讨论(0)
  • 2020-12-29 05:15

    Hitting Ctrl-F5 will clear your local (ie. the browser's cache) of any files for that site. Whereas simply opening the site in a new tab will load any files from the cache first.

    0 讨论(0)
  • 2020-12-29 05:18

    It would depend on a lot of things. For most sites, copying the url to a new window or tab will start a new session, where a refresh would maintain the current session.

    0 讨论(0)
  • 2020-12-29 05:27

    When you hit refresh (F5) the browser will ask you e.g. if you want to also send POST request (for example if you previously entered some data on a form). If you paste url and press enter you won't be able to resend mentioned POST data.

    0 讨论(0)
  • 2020-12-29 05:28

    It depends on the caching policy for the page and the method used for fetching the page in the first place. If you fetched the page via a POST, a refresh will re-send the POST data while putting the URL in a new window will issue a GET to the server.

    If the original request is a GET, the behaviour depends on how the current page is cached. Hitting refresh will cause the browser to check back with the server for the page (but not necessarily any scripts or images). If the page is set to be cacheable then pasting the URL in a new window might well just pull the page out of cache without hitting the server.

    Note that checking with the server won't necessarily cause the page to be regenerated or redownloaded as the browser can issue a conditional GET or a HEAD request to check whether the page has actually changed since last fetched. Also, while some of the actions might pull the page from the cache, there's no guarantee it will (and dynamically generated pages usually have to be set up properly to be considered cacheable at all).

    0 讨论(0)
提交回复
热议问题