barneyf Posted February 26, 2009 Share Posted February 26, 2009 I am building an application where PHP will refresh the web page on user command. I have references to a CSS and JavaScript file in the head section of the document: <head> <script type="text/javascript" src="myscript.js"></script> <link rel="stylesheet" type="text/css" href="main.css" /> </head> Does the browser (FireFox or IE) re-load the CSS & JavaScript source files every time the page is re-sent? Or is it smart enough to know it already has it loaded? I am using CSS frames, not HTML frames and I am not ready to go to Web 2.0 with Ajax & etc just yet. So if the browser blindly loads the files each time, is there a simple workaround? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/ Share on other sites More sharing options...
jackpf Posted February 26, 2009 Share Posted February 26, 2009 I think with CSS atleast there's some caching. Otherwise pages would take ages to load. I wouldn't be surprised if IE didn't though tbh. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-772152 Share on other sites More sharing options...
corbin Posted March 1, 2009 Share Posted March 1, 2009 I hate the phrase Web 2.0. And yes, browsers are smart enough to cache things, assuming the server is intelligent enough to know it's cached. (Even IE does somethings right. Weird, eh?) The way it basically works is this (there are other factors, such as whether the server tells the client to cache the content or not): *Client connects to server* *Client sends request to server for something, but also says if it has a cached copy, and if so, when the cached copy was cached.* *If the cached copy on the client side is the newest version, the server just tells the client that and nothing is transfered.* So yes, there is a little bandwidth used because of the HTTP headers, but the entire file is not transfered. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-773804 Share on other sites More sharing options...
jackpf Posted March 1, 2009 Share Posted March 1, 2009 Wow...those people who made the internet are quite clever. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-773976 Share on other sites More sharing options...
dbo Posted March 1, 2009 Share Posted March 1, 2009 Wow...those people who made the internet are quite clever. I believe it was Al Gore - http://sethf.com/gore/. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-773989 Share on other sites More sharing options...
jackpf Posted March 1, 2009 Share Posted March 1, 2009 Apparently Al Gore didn't actually create it, he just gave it his "political support" whatever that is. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-773992 Share on other sites More sharing options...
dbo Posted March 1, 2009 Share Posted March 1, 2009 Heh... I know... was a joke. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774011 Share on other sites More sharing options...
jackpf Posted March 1, 2009 Share Posted March 1, 2009 Oh, lol. Sorry Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774012 Share on other sites More sharing options...
corbin Posted March 1, 2009 Share Posted March 1, 2009 The internet != the HTTP protocol if we want to get technical ;p. I know people who sincerely think that Al Gore invented the internet. lol. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774106 Share on other sites More sharing options...
jackpf Posted March 1, 2009 Share Posted March 1, 2009 Well, tbh, the people who created the internet probably had some input on http protocol And Al Gore's an idiot, he probably doesn't know a thing about computers. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774117 Share on other sites More sharing options...
corbin Posted March 1, 2009 Share Posted March 1, 2009 Hrmmmm yeah probably. I'm not a fan of Al Gore, but I'm sure he knows some stuff. Surely. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774125 Share on other sites More sharing options...
jackpf Posted March 1, 2009 Share Posted March 1, 2009 I'm not a fan of Al Gore, but I'm sure he knows some stuff. Surely. Yeah, about tree hugging and "preserving the earth" Goddamn hippies. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774127 Share on other sites More sharing options...
corbin Posted March 1, 2009 Share Posted March 1, 2009 Eh "tree hugging" isn't all that bad. As long as it doesn't inconvenience me. (Now would be when I would say "just kidding!" but I've just never been able to make my self care about the earth x.x.) Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774146 Share on other sites More sharing options...
jackpf Posted March 1, 2009 Share Posted March 1, 2009 Yeah...it'd be pretty boring caring about the earth as well- having to turn on my pc every time I wanted to use it instead of just retrieving it from standby Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774156 Share on other sites More sharing options...
corbin Posted March 1, 2009 Share Posted March 1, 2009 I don't even let mine standby ;p. lol. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774171 Share on other sites More sharing options...
jackpf Posted March 1, 2009 Share Posted March 1, 2009 haha I'm sure Al would be shocked at your ignorance. Have you seen the south park episode with Al Gore? Lol, manbearpig Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774173 Share on other sites More sharing options...
dbo Posted March 2, 2009 Share Posted March 2, 2009 Al Gore officially hijacked this thread. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774236 Share on other sites More sharing options...
corbin Posted March 2, 2009 Share Posted March 2, 2009 And he wasn't even trying. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774259 Share on other sites More sharing options...
dbo Posted March 2, 2009 Share Posted March 2, 2009 Could he be the next Chuck Norris? Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774339 Share on other sites More sharing options...
corbin Posted March 2, 2009 Share Posted March 2, 2009 God I hope not. Quote Link to comment https://forums.phpfreaks.com/topic/147083-javascript-css-source-file-loading-efficiency/#findComment-774347 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.