Questions tagged «link-prefetch»

3
链接预取跨子域有效吗?
从简单的登录页面单击到重量级的单页面应用程序时,我一直在尝试使用类似的方法来提高性能: <link rel="prefetch" href="https://example.com" as="document" /> <link rel="prefetch" href="https://example.com/app.js" as="script" /> <link rel="prefetch" href="https://example.com/app.css" as="style" /> 当我的目标网页位于子域上时,似乎没有明显的性能提升。说,https://subdomain.example.com。 当我点击要访问的链接时https://example.com,我仍然在Chrome的“网络”标签中看到app.js并app.css加载了很长的延迟: 这是禁用预取的相同资源: 总共花费的时间大致相同。 请求标有预取缓存的资产之一的标头: 一般: Request URL: https://example.com/css/app.bffe365a.css Request Method: GET Status Code: 200 (from prefetch cache) Remote Address: 13.226.219.19:443 Referrer Policy: no-referrer-when-downgrade 响应: accept-ranges: bytes cache-control: max-age=31536000 content-encoding: gzip content-length: 39682 content-type: …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.