Pregunta

I have a strange situation where my Javascript is failing in unpredictable ways on Android 2.x devices.

Some descriptions would be:

  • Parts of the Javascript application work, while some parts do not. These "parts" are broken up as modules with separate constructors.

  • The Javascript application fails on one server and not another within our own network.

  • The Javascript application at times throws ILLEGAL TOKEN errors in multiple script files on the page, yet the application throws no errors on any desktop client and is considered to be syntactically correct.

TO FIX THIS, I type about:debug into the address bar and refresh. Boom. Suddenly the full Javascript application works, including every module and on every server.

Furthermore, now the Android "remembers" this, and the defects are gone 90% of the time, but appear once in a while at random.

This is an ASP.NET Episerver stack, and we're using Cassette to concatenate and minify about 12-20 scripts, with about 4 "final" script blocks being rendered to the page.

Has anyone encountered anything like this? My only strategy is to break up the scripts into a couple extra HTTP requests to slow down the parser... but I really don't know what's happening here.

Thanks!

¿Fue útil?

Solución

After lots of testing, we appear to have fixed the bug. It was an issue with Android 2.x downloading the Javascript files with the following header:

Content-Type: deflate

We changed it to:

Content-Type: gzip

Curious though, as to why Android 2.x has an issue with deflate configuration and Javascript files.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top