Mobile Safari iOS does not upload a few small files (like images or javascript) to the first page only

I struggled with the problem on the iPhone and iPad, where several assets failed to load at the same time. Two scenarios:

a) Downloading about 20+ external JavaScript files is not a problem on my real sites because I add my JavaScript to a single file before deployment, but it causes problems on my test server.

b) Download approx. 20+ small thumbnails on one page (each is approximately 30 kb).

In both scenarios, Safari (usually) gets stuck in multiple files and never finishes downloading them. The download indicator in the top menu of iOS loads before the update.

The second time you visit (when assets are cached) everything will be fine. I have to clear the Safari cache in order to reproduce the problem.

I can work around this problem by delaying the loading of assets in JavaScript, but it is quite difficult, and I would like to better understand what is going wrong and see if I can find a more accurate solution.

Here you can see an example (visit your iOS device): http://www.jamesgretton.co.uk/expem/so_ios_multi/

Also, if this is useful, I ran into a problem delaying the loading of thumbnails: http://www.interior-id.com/work/ , but this will be violated differently.

Any thoughts would be greatly appreciated!

James

+6
source share
2 answers

I had problems of the same type on my test server, and this was due to setting a Basic Auth password. Once we removed the authentication headers, Mobile Safari downloaded all the files as expected.

0
source

I had a similar problem with iOS Safari, and for some reason he didn’t like "use strict"; at the top of one of my javascript files. Very annoying to fix it, but the removal seems to fix the problem!

0
source

Source: https://habr.com/ru/post/910596/


All Articles