|
插入</head><body>中间就行,实测100%可行。
<center>
<script src="./js/NoSleep.min.js"></script>
<script>
//init noSleep
var noSleep = new NoSleep();
// Enable wake lock.
// (must be wrapped in a user input event handler e.g. a mouse or touch handler)
// noSleep.enable()初始化方法必须绑定在鼠标事件或触摸事件内,
// 当点击页面时就会激活不休眠功能
document.addEventListener('click', function enableNoSleep() {
document.removeEventListener('click', enableNoSleep, false);
noSleep.enable();
console.log('enable noSleep');
}, false);
</script>
</center>
|
|