我建立一個web應用程序,它涉及一種用於移動設備搖晃事件的檢測:繞道「ondevicemotion」棄用警告在Chrome
if (this.hasDeviceMotion) { window.addEventListener('devicemotion', this, false); }
我使用shake.js plugin亞歷克斯·吉布森。
當Chrome桌面瀏覽器中我得到這個警告的測試我的應用程序:
The devicemotion event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
在這個環節有這樣的文字:
We want to start applying the concepts in https://w3c.github.io/webappsec/specs/powerfulfeatures/ to features that have already shipped and which do not meet the (new, not present at the time) requirements. We want to start by requiring secure origins for these existing features: Device motion/orientation EME Fullscreen Geolocation getUserMedia()...
即使它當前已過時的桌面Chrome瀏覽器,瞭解Mountain View中的傢伙我相信它很快就會在移動Chrome和Android Webview上被棄用。
我的應用託管在沒有安全連接的服務器上,只是HTTP。有沒有辦法繞過這個警告,並在我的應用程序中使用HTTP連接進行震動檢測?
非常感謝你詳細解答! – Igal
問題:爲什麼設備定位被認爲是「強大功能」,爲什麼會被棄用?當然不僅僅是通過消除有用的但不危險的功能來被動地強迫人們進入HTTPS ...... –