防止在移动浏览器中关闭显示 [英] Prevent display turn off in a Mobile Browser
本文介绍了防止在移动浏览器中关闭显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个基于移动的网页&我正在使用网络套接字连接来处理聊天室.但是我希望每次用户通过移动浏览器转到网页时,显示屏都能打开.
I'm creating a Mobile Based web page & I'm using web socket connection to handle a chat room. But I want the display turning on every time when user go to the web page by mobile browser.
我尝试模拟按钮点击自",
I tried to simulate Button Click from,
function eventFire(el, etype){
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}
但在特定时间后仍会关闭移动显示.请问有人可以帮我吗?
But still mobile display turn off after particular time. Please can anyone help me with this??
推荐答案
由于大多数移动操作系统都需要用户交互才能阻止屏幕进入休眠状态,因此在网站上是不可能的.您需要制作一个本机应用程序.
Since most mobile OSs require user interaction to stop the screen from going to sleep this is impossible from a website. You'll need to make a native app.
这篇关于防止在移动浏览器中关闭显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文