Is it possible, in JavaScript, to detect when the screen is turned off in the Android & iOS browsers

后端 未结 4 807
暖寄归人
暖寄归人 2020-12-03 17:06

I was tracking down some ridiculously high load times that my app\'s javascript reported, and found that Android (and iOS) pause some JavaScript execution when the window is

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 18:02

    what will you do in your script once you now that the screen turns off? Well anyway, you can inject Java objects ( http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String) ) to interface with the activity and proxy all information you require in JS world.

提交回复
热议问题