开发者

Is excessive use of prefetch bad?

Just read this article on prefetching, and it states:

Of course, you have to be careful (Don’t prefetch your entire website!)

I just wondered, why? If the work is going on behind the scenes, why not just have the machine quietly collec开发者_运维百科ting your whole site?

I am assuming this is just so as not to dominate the end users resources, but have I missed something?


Yes. It's not useful to prefetch or even worse prerender everything in most cases, as the user might not even visit the page.

This is out of consideration for their bandwidth as well as for your sake.

As an example, some would consider prerendering all of the full blog posts from a list of snippets. That isn't useful to the user, as it fills their memory with rendered pages that most likely will be discarded.

Only prerender links you are 90% sure the user will click on. Prefetching resources isn't as bad, but still you only want to do it for things you are sure the user needs.


I’d argue that the user wouldn’t expect the entire website to be prefetched just because they visited the home page, so you shouldn’t.

In extreme worst cases, you could fill up their disk, or cost them large amounts of money (e.g. if they’re on a roaming 3G connection).

At the same time, why would you want to waste your own bandwidth/money sending pages and content that they’ll never look at?


Adding to Rich's answer, the other side of the coin is the server-side. If on every visit of your browser the server detects, that it tries to completely mirror the page, it might be banned. (And if not, if every browser on earth would do this, visiting a single page by just some people would effectively end in a DDoS.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜