javascript 事件的设备方向未在 chrome android 中触发 [英] deviceorientation of javascript event is not firing in chrome android

查看:37
本文介绍了javascript 事件的设备方向未在 chrome android 中触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我正在尝试触发 javascript 的 deviceorientation 事件,但事件未在我的 android 设备中触发.

window.addEventListener('deviceorientation', function(event) {
  console.log(event.alpha + ' : ' + event.beta + ' : ' + event.gamma);
});

  1. 它在 chrome 桌面上运行良好,并且事件正在被触发.(谷歌浏览器 -> 检查 -> 自定义和控制 devTools -> 更多工具 -> 传感器 -> 方向(打开并旋转虚拟设备).

3.但是,如果我从任何 android 设备事件中打开此链接,则无法正常工作.我看不到任何控制台日志或警报..是否需要任何额外的设置才能从 android 获取方向详细信息..

3.But if i open this link from any android device event is not working . I am not able to see any console log or alert..Is there any extra settings required to get orientation details from android..

感谢任何形式的帮助.

推荐答案

即使您没有安装任何 SSL 证书,您也需要打开带有 https://的页面.

You need to open page with https:// even if you don't have installed any SSL cert.

这篇关于javascript 事件的设备方向未在 chrome android 中触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆