<script>
GoFullscreen();
location.reload(); // Browser automatically goes out of fullscreen on this
</script>
如果我在网页中使用这段代码,它会进入全屏、刷新,并且浏览器会因为刷新而自动退出全屏。我需要代码在不退出全屏模式的情况下进入全屏和刷新。
<script>
GoFullscreen();
RefreshPage(); // Refreshes the page without going out of fullscreen
</script>
类似的东西
如果您想知道我为什么要尝试这样刷新页面,这是解决我的其他问题的方法 here除非我在那里得到答案。如果有人知道如何在 Canvas 上重新加载数据处理源,那么我就不需要这个了。否则刷新整个页面是我所知道的重新加载数据处理源的唯一方法。
最佳答案
您可以将内容放入 100% 宽 x 100% 高的 iframe 中。然后让 iframe 自行刷新。包含 iframe 的页面可以设置为全屏,然后 iframe 刷新不会导致父页面失去全屏模式。
关于通过 JS 全屏的一些有用信息: How to make the window full screen with Javascript (stretching all over the screen)
关于javascript - 在javascript中刷新时保持全屏模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18707071/