Safeframe加速度计和陀螺仪

时间:2020-03-11 16:42:01

标签: html iframe accelerometer

使用诸如以下这样的allow属性,可以允许通过iframe读取加速度计数据:

<iframe src="https://myotherdomain.com/sf/index.html" allow="accelerometer"></iframe>

我试图弄清楚如何在安全框架中使用加速度计。

这是到目前为止我的脚本的样子:

<!doctype html>
<html>
<body>
<div id='tgtLREC'></div>
<script type='text/x-safeframe' class='sf_data'>
{
    "id": "adLREC",
    "src": "https://myotherdomain.com/sf/",
    "conf":
        {
            "w":400,
            "h":400,
        }
}
</script>
<script type="text/javascript" src="https://myotherdomain.com/sf/src/js/lib/base.js"></script>
<script type="text/javascript" src="https://myotherdomain.com/sf/src/js/host/hosts.js"></script>
<script type="text/javascript" src="https://myotherdomain.com/sf/src/js/lib/boot.js"></script>
<script type="text/javascript">
    (function(){
        var conf = new $sf.host.Config({
            renderFile: "https://myotherdomain/sf/src/html/r.html",
            positions: {}
        });
    })();
</script>

</body>
</html>

记录下来,我已经尝试学习安全框架几天了,但我真的不知道我在做什么。我注意到safeframe最终在页面中插入了iframe,希望我能够在其中插入allow属性。我没有在网上文档中找到任何明确引用此内容的内容。任何帮助或指向适当资源的指示将不胜感激。

0 个答案:

没有答案