• 请不要在回答技术问题时复制粘贴 AI 生成的内容
zsh1995
V2EX  ›  程序员

chrome http 协议的网站无法获取 window.DeviceOrientationEvent

  •  
  •   zsh1995 · Oct 2, 2019 · 2592 views
    This topic created in 2457 days ago, the information mentioned may be changed or developed.
    当前用的 chrome 版本是 77,在调试时发现获取 window.DeviceOrientationEvent 是 undefined,排除了半天才发现是 http 的锅,只有 https 的网站才能拿到 DeviceOrientationEvent。那开发时弄个 https 也挺麻烦,有啥别的方法绕过吗?
    2 replies    2019-10-03 04:52:13 +08:00
    Pastsong
        1
    Pastsong  
       Oct 2, 2019
    localhost 可以绕过
    codehz
        2
    codehz  
       Oct 3, 2019   ❤️ 2
    chrome://flags/#unsafely-treat-insecure-origin-as-secure 填上你需要的域名,然后重启)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   922 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 20:41 · PVG 04:41 · LAX 13:41 · JFK 16:41
    ♥ Do have faith in what you're doing.