I've been fighting a problem on the iPhone and iPad where it fails to load multiple assets at the same time. Two scenarios:
我一直在与iPhone和iPad上的一个问题作斗争,它无法同时加载多个资产。两个场景:
a) Loading approx 20+ external JavaScript files - this is not a problem on my live sites because I combine my JavaScript into one file before deploying, but causes issues on my test server.
a)加载大约20+外部JavaScript文件——这在我的live站点上不是问题,因为我在部署之前将JavaScript合并到一个文件中,但会导致测试服务器出现问题。
b) Loading approx. 20+ small thumbnail images on the same page (each one is roughly 30kb).
b)加载约。在同一页面上有20多个小的缩略图(每个大概是30kb)。
In both scenarios Safari (usually) gets stuck on a handful of files and never finishes loading them. The loading indicator on the iOS top menu is stuck loading until a refresh.
在这两种情况下,Safari(通常)会被卡在一些文件上,并且永远不会加载完。iOS顶部菜单上的加载指示灯被卡住,直到刷新。
The second time you visit (when the assets are cached) all will be fine. I have to clear Safari's cache to reproduce the issue.
第二次访问时(缓存资产时)一切都没问题。我必须清除Safari的缓存才能重现问题。
I can get round the issue by delaying load of the assets in JavaScript, but this is quite bodgy and I'd like to better understand what's going wrong and see if I can find a neater solution.
我可以通过延迟JavaScript中的资产负载来解决这个问题,但这是一个很复杂的问题,我想更好地理解到底哪里出了问题,看看我是否能找到一个解决方案。
An example can be seen here (visit on an iOS device): http://www.jamesgretton.co.uk/expem/so_ios_multi/
可以在这里看到一个示例(访问iOS设备):http://www.jamesgretton.co.uk/expem/so_ios_multi/
Also, in case it's useful, I've got round the problem here by delaying the load of the thumbnails: http://www.interior-id.com/work/ but it would break otherwise.
另外,如果它有用的话,我可以通过延迟缩略图的加载来解决这个问题:http://www.interior-id.com/work/,但是它可能会中断。
Any thoughts would be greatly appreciated!
任何想法都将非常感谢!
James
詹姆斯
2 个解决方案
#1
0
I had issues of the same kind on my test server, and it was related to the Basic Auth password configuration. As soon as we removed the Authentication headers, Mobile Safari was loading all files as expected.
我在测试服务器上遇到了同样的问题,它与基本的Auth密码配置有关。一旦我们删除了身份验证头,Mobile Safari就会按预期加载所有文件。
#2
0
I had a similar problem with IOS Safari and for some reason it didn't like "use strict"; at the top of one of my javascript files. Very annoying to work this out but removing it seems to have fixed the issue!
我对IOS Safari也有类似的问题,出于某种原因它不喜欢“使用严格”;在我的一个javascript文件的顶部。解决这个问题很烦人,但是删除它似乎解决了问题!
#1
0
I had issues of the same kind on my test server, and it was related to the Basic Auth password configuration. As soon as we removed the Authentication headers, Mobile Safari was loading all files as expected.
我在测试服务器上遇到了同样的问题,它与基本的Auth密码配置有关。一旦我们删除了身份验证头,Mobile Safari就会按预期加载所有文件。
#2
0
I had a similar problem with IOS Safari and for some reason it didn't like "use strict"; at the top of one of my javascript files. Very annoying to work this out but removing it seems to have fixed the issue!
我对IOS Safari也有类似的问题,出于某种原因它不喜欢“使用严格”;在我的一个javascript文件的顶部。解决这个问题很烦人,但是删除它似乎解决了问题!