Solved

website errors - browser caching and Vary: Accept-Encoding header

Posted on 2012-03-13
5
543 Views
Last Modified: 2012-03-14
i have a site i am working on,

i get low scores due to these errors,

Leverage browser caching
and
Specify a Vary: Accept-Encoding header

i looked at there links to google, but have not been able to incorporate it into the site.

thanks for your help.

here is an image and link

http://tools.pingdom.com/fpt/#!/OU1lfq4AL/http://fordag.com

errors
0
Comment
Question by:webdott
  • 2
  • 2
5 Comments
 

Author Comment

by:webdott
ID: 37718204
found this - understand it now:

create a notepad file called:

.htaccess

save this in it:
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType image/bmp "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType text/javascript "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType text/xml "access 1 month"
ExpiresByType text/plain "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##

how do i add this to expire?
http://www.google-analytics.com/ga.js

I tried:
ExpiresByType application/js "access 1 month"

thanks for any help
0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 37719456
The ga.js is hosted by a different site. Since you are not the owner, you cannot control its caching/expiration.
0
 
LVL 25

Expert Comment

by:kevp75
ID: 37719791
That is not necessarily true gr8gonzo...  you could devise a method to download the js file, and build in a caching mechanism

I do it in .Net
0
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 500 total points
ID: 37720049
@kevp75, if it were a standard JS file that could run locally, I would agree, but typically the JS files from web traffic analysis services like Google Analytics, Omniture, Hitbox, WebTrends, etc... - those NEED to run from the host service. When the browser hits it, the service is notified of that hit. GA may be able to be tinkered with, but it's not the recommended path, nor would it speed up the site at all.

Plus, if Google wants you to cache that file, then by hosting it themselves, they are suppressing a lot of internet traffic overall (if you download it from Site A, then it becomes cached for Site B, C, and D that also use the same file). In fact, webdott could very well be Site B or C or D so it may already be cached by a visitor who has been on a different site that used the analytics JS. By trying to host it himself, he could be adding more unnecessary downloads for his visitor.

Also, most browsers have a limit on how many simultaneous transfers they get from a domain, so by pulling the JS from Google Analytics's domain, you're actually allowing the browser to pull more resources faster (when they don't have it cached). While IE (for example) is pulling 2 resources from webdott's domain, it can also pull the GA resource at the same time. (This is why CDNs can make such a positive impact on performance - it's a divide and conquer strategy).
0
 

Author Closing Comment

by:webdott
ID: 37720212
thanks for explaining it.  it sucks i can't index it to get a score of 100,
but google already does its best to speed the internet.

the site still runs fast. i was just trying to fix all the bugs.

thanks again for your help and detailed info.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now