Why Refresh [f5] is different then Enter from the address bar and press Enter key? [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
开发者_如何学JAVA Improve this questionI have making benchmarking on the application I have I found a thing who amazed me and I want to clear the things that why both are different.
pressing in Address bar and press enter open my page in 1.5 to 3 seconds)
if I press Refresh button in Firefox it's take long time then press enter (3 to 6 second)
I really not know what thing's matter here. are refresh button not take image , css or js from cache.
Are anyone specify me what things matter here.
The HTTP requests sent differ. By pressing enter, you tell the browser to navigate to some page and apply normal resource caching behavior (just like clicking a link). This means that the linked CSS file which takes 2 seconds to generate on the server and was sent with: "Max-Age: 1 year" header, will not be fetched again if it is available in local cache.
With F5, you explicitly tell the browser to refresh the resources used on the page. Typically image/css/js files are requested again, and resources are not fetched with "If-Modified-Since" or "If-None-Match" headers.
I don't think this is part of any specification, but it makes sense to web developers if they see server resource changes reflected regardless of caching rules.
I'd guess you have hidden form data somewhere. If you hit f5, Firefox will resend that data (sometimes accompanied by a warning message to that effect). If you just hit Enter, it's a new, 'clean' request for the same URL.
It probably redraws the page contents from the memory. Pressing F5 will definitely make the browser to make HEAD http requests for all files used in the page. Subsequently, the browser will make GET requests for newer files. This would explain the delay.
精彩评论