Javascript 如何解决devicemotion脚本的问题?

Javascript 如何解决devicemotion脚本的问题?,javascript,ssl,browser,devicemotion,Javascript,Ssl,Browser,Devicemotion,我不确定这是不是该问的地方,但我的devicemotion脚本有问题 我有一些代码在加载页面时运行,以检查是否有陀螺仪可用。我是这样做的: function check_user_hardware(){ if (mobile_size <= 600) { hidden = true; } console.log("checking hardware"); giro_timer = setTimeout(update_gyro_value,

我不确定这是不是该问的地方,但我的
devicemotion
脚本有问题

我有一些代码在加载页面时运行,以检查是否有陀螺仪可用。我是这样做的:

function check_user_hardware(){

    if (mobile_size <= 600) {
        hidden = true;
    }
    console.log("checking hardware");
    giro_timer = setTimeout(update_gyro_value, 30);
    window.addEventListener("devicemotion", function(event){
        console.log("device motion?");
        if(event.rotationRate.alpha || event.rotationRate.beta || event.rotationRate.gamma){
            calculate_rotation_mesh_pos(event.rotationRate.beta, event.rotationRate.gamma);
            if (!gyroscope) {
                gyroscope = true;
                console.log("gyroscope here");
                current_interaction_mode = 'gyroscope_option';
                set_user_ui_elements();
            }
        }else{
            followMouse = true;
            console.log("no gyroscope here");
            current_interaction_mode = 'followMouse_option';
            set_user_ui_elements();
            window.addEventListener('mousemove', get_user_mouse_pos);
        }
    });
}
就这样。为什么我的devicemotion事件没有触发? 即使在我的网站上使用基本的SSL加密,它也不起作用,为什么? 我需要某种特殊的SSL加密吗?
这是怎么回事? 欢迎所有建议
如果需要更多信息,我很乐意提供。

你可以在这里看到有问题的网站:gravient.thomashoek.com

我的webapp也面临同样的问题。我看到Chromium 62上的加速计存在问题,但似乎v.63中的加速计已经修复

然而,“devicemotion”事件在我这边的chrome Android上也不起作用了(但在iOS上工作得很好)

checking hardware