Android Stock 浏览器中 mootools 的 Javascript 错误 (2.2)(未捕获的语法错误:意外的输入结束)
从我的服务器加载 Mootools More 时,Android Stock 浏览器(froyo 2.2 和姜饼 2.3)失败并开始抱怨
Uncaught SyntaxError: Unexpected end of input
该问题据报道也存在于 Android Gingerbread 2.3 上的 Dolphin 浏览器中。
起初我认为这可能是传输编码错误,但没有其他桌面浏览器(msie 6-9、ff 2-4、safari、chromium)或在 Android 2.3 上运行的 Firefox 移动版遇到任何编码问题。
我的第二个想法是内容长度不正确,大多数浏览器都能检测到这一点并很好地管理它,但 Android Stock 浏览器除外。但经过仔细测量,这个理论也被证明是错误的。
在其他 WebKit 浏览器中,此问题似乎主要是由于缺少结束括号 (}
) 引起的,但对我来说这显然不是一个可能的原因。因为:
- 两个未更改的标准 Mootools 都存在问题——应该正确地括起来。
- 该问题可以在 Mootools 的多个版本中重现(1.2 和 1.3 都已测试)
编辑:真正的问题实际上是传输编码的问题。如果 Accept-Encoding 指示 deflate 或 gzip,则始终使用 Deflate。除了 Android 浏览器之外,Googlebot 在我们的网站上也存在问题。
When loading Mootools More from my server, Android Stock Browser (froyo 2.2 and gingerbread 2.3) flunks out and starts to complain about
Uncaught SyntaxError: Unexpected end of input
The problem is also reported to exist in Dolphin browser on Android Gingerbread 2.3.
At first I figured it could be a transfer-encoding error, but no other desktop browser (msie 6-9, ff 2-4, safari, chromium) nor firefox mobile running on Android 2.3 are experiencing any encoding issues.
My second thought was that the content-length was incorrect, and that most browsers detected this and managed it nicely, but not Android Stock browser. But after careful measurements, this theory has been proven wrong as well.
In other WebKit browsers, this issue mostly seems to be caused by missing end brackets (}
), but it does certainly not appear to be a probable reason for me. Because:
- The problem exists for both standard Mootools, unaltered, -- which should be correctly bracketed.
- The problem can be reproduced for multiple versions of Mootools (both 1.2 and 1.3 have been tested)
Edit: The real problem was actually problem with the transfer-encoding. Deflate was allways used if the the Accept-Encoding indicated deflate or gzip. Apart from the Android browsers, Googlebot had problems with our site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
真正的问题实际上是传输编码的问题。如果 Accept-Encoding 指示 deflate 或 gzip,则始终使用 Deflate。除了 Android 浏览器之外,Googlebot 在我们的网站上也存在问题。
The real problem was actually problem with the transfer-encoding. Deflate was always used if the the Accept-Encoding indicated deflate or gzip. Apart from the Android browsers, Googlebot had problems with our site.
在运行 OS 4.1.2 的 Galaxy S3 上,当文件末尾的脚本包含用
//
标记注释的行时,WebView 会引发完全相同的错误(指向第 1 行),如下所示:http://code.google.com/p/android/issues/detail?id=23437On Galaxy S3 with OS 4.1.2 the very same error was thrown from WebView (pointing line 1) when script at the end of file contained line commented with
//
markup, as reported here: http://code.google.com/p/android/issues/detail?id=23437