How to leverage browser cache a specific file
-
Hello all,
I am trying to figure out how to add leverage browser caching to these items.- http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&language=en
- http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js
- http://www.google-analytics.com/analytics.js
Whats hard is I understand the purpose, but unlike a css file, how do you specify an expiration on an actual direct path file?
Any help or link to get help is appreciated.
Chris
-
Well I guess it's what it is
thank you so much for your insight
-
Unfortunately, you can't specify browser caching for 3rd party content, Chris. Those cache specs would have to implemented by the site the content is actually hosted on.
The only way around this would be to store the 3rd party scripts on your own site and reference them locally. Then they would fall under the caching directives your site had set. This is usually a bad idea though, as it means you'll have no way of knowing when those scripts might have been updated.
This is one of those areas where site speed best practices simply can't be applied to 3rd party content. And if it's just a few such resources it's not going to have much effect on page speed anyway. Where possible, try to load these scripts asynchronously (like analytics.js) or at least place them in the footer of site if you can.
Hope that helps?
Paul
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Setting country specific top level domain as alias - will site benefit from TLDs authority?
I have a host of sites that follow a top level domain strategy. For each local site they will be on the top level domain but with their country-languages prefix as the subdirectory. Such as below: example.com
Intermediate & Advanced SEO | | gracejo
example.com/uk-en
example.com/sg-en
example.com/de-de Each local site being on the TLD will benefit them in terms of SEO and it makes it easier to have one strategy. My question however, if the Netherlands comes on board, they would generally have example.com/nl-en. However they want their primary domain as examplenetherlands.nl and the TLD (example.com/nl-en) set as an alias/secondary domain that redirects to the primary. Will they benefit from any SEO if the TLD is not the primary address?0 -
Google disavow file
Does anybody have any idea how often Google reads the disavow file?
Intermediate & Advanced SEO | | seoman100 -
If my website do not have a robot.txt file, does it hurt my website ranking?
After a site audit, I find out that my website don't have a robot.txt. Does it hurt my website rankings? One more thing, when I type mywebsite.com/robot.txt, it automatically redirect to the homepage. Please help!
Intermediate & Advanced SEO | | binhlai0 -
Recovering old disallow file?
Hi guys, We had aN SEO agency do a disallow request on one of our sites a while back. They have no trace of the disallow txt file and all the links they disallowed. Does anyone know if there is a way to recover this file in google webmaster tools or anyway to find which links were disallowed? Cheers.
Intermediate & Advanced SEO | | jayoliverwright0 -
Country specific results
Our country specific pages reside as a subfolder under the main domain. So for example in US it's /us/, in Canada it's /ca/. What we've noticed is that Google Canada is showing US pages in some of the search results. Does anyone have experience with how to direct Google to display country specific page results?
Intermediate & Advanced SEO | | kxu0 -
404 in Google cache for one of my blog posts
Hey Moz People, I'm getting a 404 when I cache: this blog post http://www.inscopix.com/blog/decoding-brain-initiative and I'm not able to see what's causing it. Can someone take a look and let me know if they see anything standing out? Thanks,
Intermediate & Advanced SEO | | jacobfy0 -
Large volume of ning files in subdomain - hurting or helping?
I have a client that has 600 pages in their root domain and a subdomain that contains 7500 pages of un-seoable Ning pages. PLUS another 650 pages from Sched.com that also is contributing to a large volume of errors. My question is - should I create a new domain for the Ning content - or am I better off with the volume of pages - even if they have loads of errors? Thanks!
Intermediate & Advanced SEO | | robertdonnell0 -
How do you prevent the mobile site becoming a duplicate of the full browser site?
We have a larger site with 100k+ pages, we need to create a mobile site which gets indexed in the mobile engines but I am afraid that google bot will consider these pages duplicates of the normal site pages. I know I can block it on the robots.txt but I still need it to be indexed for mobile search engines and I think google has a mobile crawler as well. Feel free to give me any other tips that I should follow while trying to optimize the mobile version. Any help would be appreciated 🙂
Intermediate & Advanced SEO | | pulseseo0