lizongbo at 618119.com 工作,生活,Android,前端,Linode,Ubuntu,nginx,java,apache,tomcat,Resin,mina,Hessian,XMPP,RPC

2012年01月31日

Android4.0系统浏览器支持window.performance API了

Filed under: Android,JavaScript,Web,前端开发 — 标签:, , — lizongbo @ 22:25

4.0系统浏览器支持window.performance API了

window.performance API是HTML5规范的一部分,
window.performance规范的官方文档在:
https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
目前还是草稿阶段,中文介绍可以参考:
http://www.cnblogs.com/_franky/archive/2011/11/07/2238980.html
webkit的测试用例和属性列表可以参考:
http://svn.webkit.org/repository/webkit/trunk/LayoutTests/fast//dom/Window/window-properties-performance.html
http://svn.webkit.org/repository/webkit/trunk/LayoutTests/fast//dom/Window/window-properties-performance-expected.txt

Android4.0系统自带的浏览器实现了这一规范,并且还扩展实现window.performance.memory。

通过JavaScript实际测试结果如下:
window.performance.memory=[object MemoryInfo]
window.performance.timing=[object PerformanceTiming]
window.performance.navigation=[object PerformanceNavigation]
window.performance.timing.connectStart=1328016452403
window.performance.timing.responseStart=1328016452403
window.performance.timing.domLoading=1328016453857
window.performance.timing.connectEnd=1328016452403
window.performance.timing.domInteractive=0
window.performance.timing.fetchStart=1328016452403
window.performance.timing.secureConnectionStart=0
window.performance.timing.domainLookupStart=1328016452403
window.performance.timing.responseEnd=0
window.performance.timing.requestStart=1328016452403
window.performance.timing.loadEventEnd=0
window.performance.timing.domComplete=0
window.performance.timing.redirectStart=0
window.performance.timing.unloadEventEnd=1328016453646
window.performance.timing.domContentLoadedEventStart=0
window.performance.timing.domContentLoadedEventEnd=0
window.performance.timing.domainLookupEnd=1328016452403
window.performance.timing.navigationStart=1328016452402
window.performance.timing.unloadEventStart=1328016453646
window.performance.timing.loadEventStart=0
window.performance.timing.redirectEnd=0
window.performance.navigation.redirectCount=0
window.performance.navigation.type=1
window.performance.navigation.TYPE_NAVIGATE=0
window.performance.navigation.TYPE_RELOAD=1
window.performance.navigation.TYPE_BACK_FORWARD=2
window.performance.navigation.TYPE_RESERVED=255
window.performance.memory.totalJSHeapSize=0
window.performance.memory.usedJSHeapSize=0
window.performance.memory.jsHeapSizeLimit=0

PS:Android从2.1版本还扩展实现了navigator.connection:
通过JavaScript测试结果如下:
navigator.connection.type=4
navigator.connection.UNKNOWN=0
navigator.connection.ETHERNET=1
navigator.connection.WIFI=2
navigator.connection.CELL_2G=3
navigator.connection.CELL_3G=4

 

没有评论 »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress