felito Posted May 23, 2011 Share Posted May 23, 2011 hi if I have these files: index.php - load jquery and style.css home.php data.php Contacts.php i need to repeat the same load to the others files? home, data? There is any way to avoid it? in this case i don't use ajax thanks Quote Link to comment https://forums.phpfreaks.com/topic/237267-initial-load-of-content/ Share on other sites More sharing options...
Adam Posted May 24, 2011 Share Posted May 24, 2011 Sorry are you talking along the lines of caching, or using the same <head> code without having to repeat it in each file? ...Or something else? Quote Link to comment https://forums.phpfreaks.com/topic/237267-initial-load-of-content/#findComment-1219467 Share on other sites More sharing options...
felito Posted May 24, 2011 Author Share Posted May 24, 2011 for example i have this file in all files <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script> my idea is just load the file in the first page, index.php and avoid the load in the other pages. But i seen in the firebug and the file is only loaded in the first php. The others subpages using the same file in cache. So, my problem don't make sense. Quote Link to comment https://forums.phpfreaks.com/topic/237267-initial-load-of-content/#findComment-1219560 Share on other sites More sharing options...
Adam Posted May 24, 2011 Share Posted May 24, 2011 On the second page though you're making a new request, a brand new 'document' in the eyes of the web browser. You need to tell the browser what resources are needed in this document, so that it can include them. Caching is handled separately from that, and prevents the browser having to re-download the resources each time. While you might see benefits to preserving resources without having to explicitly include them on subsequent pages, you don't need every resource on every page and you it would make maintaining/removing them a nightmare. It's easier to say what is needed than what's not, and obviously makes more sense to do it that way. Quote Link to comment https://forums.phpfreaks.com/topic/237267-initial-load-of-content/#findComment-1219579 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.