gpt4 book ai didi

javascript - 全屏 API 不适用于 Chrome/iOS

转载 作者:行者123 更新时间:2023-11-30 07:39:48 26 4
gpt4 key购买 nike

我试图在用户点击链接/按钮时全屏显示视频。这在桌面上运行良好,但在使用 chrome 的 iPad 上运行不佳。

根据这个http://caniuse.com/fullscreen有一些限制,但我在那张 table 上找不到 chrome/ios。

如果有人告诉我这是一个操作系统限制,我将非常感谢来自良好来源的链接。

这是一些代码:

HTML:

<video id="video1" width="420" controls>
<source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4" />
<source src="http://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg" />Your browser does not support HTML5 video.</video>

<button onclick="PlayFunction();">PLAY</button>

Javascript:

 function PlayFunction()
{
launchFullScreen(document.getElementById("video1")); // any individual element);
$("#video1")[0].play();

}function launchFullScreen(element) {
if (element.requestFullScreen) {
element.requestFullScreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {

element.webkitRequestFullScreen();
}
else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
} else if (element.webkitRequestFullscreen) {

element.webkitRequestFullscreen();
} else {

alert("no cai en ningun lado");
}
}

JSfiddle:http://jsfiddle.net/9aSjn/16/

最佳答案

根据此链接http://www.mobilexweb.com/blog/chrome-ios-android-4-1-jelly-bean-html5 :

That’s is because Chrome for iOS is not Chrome. What?? It has a Chrome-style UI, onmibox, search by voice and it has Chrome synching. However, the rendering and execution engine are not Chrome.

I called them pseudo-browsers and you can see my opinion and a good discussion on the comments area in my previous post. So Chrome for iOS is in fact using the iOS Web View that share most of the code with Safari.

The User Agent that Chrome for iOS is using is the Safari one with one addition: “CriOS” (Chrome for iOS I guess). There is no “Chrome” word inside the User Agent, so if you are doing something special for Chrome, you are safe and it’s not going to be executed on Chrome on iOS.

结论,当您在 iOS 上使用 Chrome 时,您正在使用 Safari,这就是它没有出现在 caniuse 表中的原因。

关于javascript - 全屏 API 不适用于 Chrome/iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20602467/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com