javascript - requestFullscreen 没有返回 promise

标签 javascript google-chrome firefox html5-fullscreen chromebug

我遇到了意外的行为,并想在填补错误之前确保我没有遗漏某些内容。
我在 chromefirefox 上玩过 requestFullscreen ,注意到它没有返回 spec 中所述的 promise 。 。

webkit 示例:

el.addEventListener('click', () => {
    const p = el.webkitRequestFullScreen();
    p.then(() => {console.log('full screen')});
});

我得到:

Uncaught TypeError: Cannot read property 'then' of undefined at HTMLDivElement.el.addEventListener

同样适用于firefox:

el.addEventListener('click', () => {
    const p = el.mozRequestFullScreen();
    p.then(() => {console.log('full screen')});
});

TypeError: p is undefined

我读错了规范吗?我不应该期待那个 promise 吗?

最佳答案

关于javascript - requestFullscreen 没有返回 promise ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52051547/

相关文章:

javascript - JS 函数调用在 Chrome 和 Opera 中不起作用(JS + jQuery)

c# - 运行 selenium 单元测试时 Firefox 崩溃

css - @font-face 适用于 Chrome 和 Safari,但不适用于 Firefox

ios - 在 iOS 版 Chrome 中下载 Apple Pass 时出错

Javascript MySQL 错误?

html - CSS3 属性列数。 Chrome、Firefox 和 Safari 中的不同显示

javascript - 使用输入按钮提交文本框表单

google-chrome - Chrome 扩展程序 : Execute background page only once when chrome starts

javascript - 我怎样才能在我的代码中只显示我想要的文本?

javascript - 如何通过鼠标悬停来制作图案