0

While checking the page speed, Google Page speed suggested me to "Leverage Browser Caching". As I enabled the caching in my MVC application using this code in .config file.

<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00"/>

After this, caching for static content which comes from my own domain is being cached, yet it is working.

However, static resources which comes from external domains are not being cached. For example: mydomain.com/content/scripts/somescript.js --> BEING CACHED http://widget.uservoice.com/ha3YmZucx5RAYmq2cS9qw.js --> NOT BEING CACHED

Google is still suggesting me to "Leverage Browser Caching" for that reason.

How can I enable my application to cache static resources which comes from external domains?

1 Answer 1

3

You can't cache static resources from third-party domain; that's not how things work. If there's third-party resources not being cached, that means that third-party has either directly chosen not to employ caching (it may need to be always up-to-date to function properly) or has neglected to implement caching. The only thing you can do about that is submit a ticket to the third-party and ask them to fix it.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks Chris. I've just tried smashingmagazine.com on Google Page Speed, and it is suggesting to cache only one resource, which is a .js file. However, on the page source, I've found 5-6 resource that is coming from external domain. If i cannot cache them, is there at least some way that I can do to load them faster and prevent from being suggested by google like smashingmagazine for example?
Each webserver (which for ease of discussion we'll directly associate to one domain), has to implement its own caching scheme. So, it's not an issue of whether it's a third-party domain or not; it's an issue of whether that third-party domain implemented caching. Like I said in my answer, there's sometimes good reason not to implement caching for a resource. It just depends, but ultimately it's either cached or it isn't. There's nothing you can do about it either way. It's possible Page Speed might let you ignore the resource or something, you'll just have to check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.