使用 HTML5 预取的危险?
好的,所以这还不是一个大问题,因为它仅受少数浏览器支持:
- Mozilla Firefox:支持
- Google Chrome:自版本 13 起支持(使用替代语法)
- Safari:当前不支持 Internet
- Explorer:当前不支持
但是,预取让我抽搐。如果用户登陆您的页面并跳转到另一个网站,您是否为他们访问您的预取链接的带宽付费?
开发人员预取页面上的每个链接是否存在风险,这反过来又会使网站的用户体验变慢?
看起来它可以改变分析。人们会通过预取强制用户浏览页面吗?
安全性,您不会知道正在预取哪些页面。它可以预取恶意文件吗?
对于使用量有限的移动用户来说,所有这些预取是否会很痛苦?
Ok, so it isn't a huge worry yet as it is only supported by a few browsers:
- Mozilla Firefox: Supported
- Google Chrome: Supported since version 13 (Use an alternate syntax)
- Safari: Currently not supported Internet
- Explorer: Currently not supported
However, prefetch makes me twitch. If the user lands on your page and bounces off to another site have you paid for the bandwidth of them visiting your prefetch links?
Isn't there a risk of developers prefetching every link on the page which in turn would make the website a slower experience for user?
It looks like it can alter analytics. Will people be forcing page views onto users via prefetch?
Security, you wont know what pages are being prefetched. Can it prefetch malicious files?
Will all this prefetching be painful for mobile users with limited usage?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不能称自己是该主题的专家,但我可以做出以下观察:
正如我所说,我不能保证上述任何事情,但是(与任何技术一样)这是最佳实践的案例。您不会使用
Cache-Control
强制将网站上的每个页面缓存一年。您也不希望浏览器满足跨域 Ajax 请求。希望预取也能采取同样的考虑。I can't call myself an expert on the subject, but I can make these observations:
As I've stated, I can't guarantee any of the above things, but (like with any technology) it's a case of best practices. You wouldn't use
Cache-Control
to force every page on your site to be cached for a year. Nor would you expect a browser to satisfy a cross-domain Ajax request. Hopefully the same considerations were/will be taken for prefetching.为了回答分析和统计的问题,规范有以下内容:
To answer the question of analytics and statistics, the spec has the following to say: