javascriptandroidasp.netcassette

Bug where Android about:debug fixes JS


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

Some descriptions would be:

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!


Solution

  • 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.