What requests will be generated by the browser's "F5" and "Ctrl + F5" refresh?
P粉593649715
P粉593649715 2023-10-11 10:38:51
0
2
516
Is there a standard for actions

F5andCtrlF5are triggered in web browsers?

I have done experiments in IE6 and Firefox 2.x.F5Refresh will trigger an HTTP request to the server that contains theIf-Modified-Sinceheader, whileCtrlF5does not There will be a title like this. From my understanding,F5will try to leverage as much of the cached content as possible, whileCtrlF5aims to discard all cached content and just retrieve all from the server again content.

But today, I noticed that in some of the latest browsers (Chrome, IE8) it no longer works this way.F5andCtrlF5both send theIf-Modified-Sinceheader.

So how is this supposed to work, or (if there's no standard) how do the major browsers differ in how they implement these refresh functions?

P粉593649715
P粉593649715

reply all (2)
P粉665679053

It depends on the browser, but they behave in similar ways.

F5Usually a page is updated only when it has been modified. Modern browsers sendCache-Control: max-age=0to tell the maximum time (relative to the time of the request) that any cached resource will be considered fresh.

CTRL-F5is used to force an update, ignoring any cache. Modern browsers sendCache-Control: no-cacheandPragma: No-cache

If I remember correctly, Netscape was the first browser to add cache control support by addingPragma: No-cachewhen pressingCTRL-F5.

┌───────────┬──────────────┬─────┬─────────────────┬──────────────────────────────┐ │ Version 4 │ F5 │ R │ CLICK │ Legend: │ │2021 MAY 19├──┬──┬──┬──┬──┼──┬──┼──┬──┬──┬──┬──┬──┤ C = Cache-Control: no-cache │ │ │ │S │C │A │A │C │C │ │S │C │A │A │C │ I = If-Modified-Since │ │ │ │H │T │L │L │T │T │ │H │T │L │L │T │ M = Cache-Control: max-age=0 │ │ │ │I │R │T │T │R │R │ │I │R │T │T │R │ N = Not tested │ │ │ │F │L │ │G │L │L │ │F │L │ │G │L │ P = Pragma: No-cache │ │ │ │T │ │ │R │ │+ │ │T │ │ │R │+ │ - = ignored │ │ │ │ │ │ │ │ │S │ │ │ │ │ │S │ │ │ │ │ │ │ │ │ │H │ │ │ │ │ │H │ With 'CLICK' I refer to a │ │ │ │ │ │ │ │ │I │ │ │ │ │ │I │ mouse click on the browsers │ │ │ │ │ │ │ │ │F │ │ │ │ │ │F │ refresh-icon. │ │ │ │ │ │ │ │ │T │ │ │ │ │ │T │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ 1: Version 3.0.6 sends I │ ├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ and C, but 3.1.6 opens │ │Brave 1.24 │M │CP│CP│- │- │M │CP│M │CP│CP│M │CP│CP│ the page in a new tab, │ ├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ making a normal request │ │Chrome 1 │MI│MI│MI│- │- │MI│- │MI│MI│MI│MI│MI│N │ with only I. │ │Chrome 6 │MI│CP│CP│- │- │MI│CP│MI│CP│CP│MI│- │N │ 2: Version 10.62 does │ │Chrome 90 │M │CP│CP│- │- │M │CP│M │CP│CP│M │CP│CP│ nothing. 9.61 might do C │ ├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ unless it was a typo in │ │Edge 90 │M │CP│CP│- │- │M │CP│M │CP│CP│M │CP│CP│ my old table. │ ├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ 3: Opens the currernt tab in │ │Firefox 3.x│MI│- │CP│- │- │MI│CP│MI│CP│1 │M │MI│N │ a new tab, but does not │ │Firefox 89 │M │- │CP│- │M │M │CP│M │CP│3 │M │M │3 │ refresh the page if it is │ ├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ cached in the browser. │ │MSIE 8, 7 │I │- │C │- │I │I │ │I │I │C │I │I │N │ │ ├───────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤ │ │Opera 10, 9│C │- │- │2 │- │C │- │C │C │C │C │- │N │ │ │Opera 76 │M │CP│CP│- │- │M │- │M │CP│CP│M │CP│CP│ │ ├───────────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──────────────────────────────┤ │ https://stackoverflow.com/a/385491/36866 │ └─────────────────────────────────────────────────────────────────────────────────┘

Note on Chrome 6.0.472: If you do a force reload (e.g.CTRL-F5), it will behave as if the URL is in Internally marked as always force reload. If you go to the address bar and press Enter, the flag will be cleared.

    P粉675258598

    Generally speaking:

    F5may serve you the same page even if the content changes because it may load the page from cache. ButCtrlF5will force a cache refresh and guarantee that if the content changes, you'll get the new content.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!