如何以编程方式退出亭子模式

发布于 2025-02-12 20:07:57 字数 487 浏览 1 评论 0原文

我正在开发一个在Edge(学校默认浏览器)中运行的系统,该浏览器从桌面快捷方式以售货亭模式启动,

“ C:\ Program Files(x86)\ Microsoft \ Microsoft \ Edge \ expact \ MSEDGE \ MSEDGE.EXE” -KIOSK” -KIOSK < a href =“ http://www.program-name.com” rel =“ nofollow noreferrer“> www.program-name.com - edge-kiosk-type =

登录页面上的全屏幕,我可以在进入

<input type="button" onClick="window.close();" value="Close">

程序中,使用关闭按钮,下一页, 我可以使用关闭按钮来退出该程序。 ,窗口。关闭不再有效。退出的唯一方法是使用alt + f4或按下启动键并右键单击边缘图标

I'm developing a system that runs in Edge (school's default browser), the browser launches in Kiosk mode from a desktop shortcut

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --kiosk www.program-name.com --edge-kiosk-type=fullscreen

On the landing page, I can exit the program no problem with a close button using

<input type="button" onClick="window.close();" value="Close">

Once you proceed into the program, next page onwards, window.close no longer works. The only way to quit is by using Alt + F4 or pressing the Start key and right clicking the Edge icon

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

和我恋爱吧 2025-02-19 20:07:57

如果打开开发人员工具控制台,当窗口不通过window.close.close()

脚本只能关闭他们打开的窗口。

消息很清楚。使用window.close()关闭窗口时,会有一些限制。在Chromium中,window.close()如果新窗口/TAB具有开启器,或者背面/正向堆栈包含少于两个条目。 window.close()的限制用于安全性和用户体验。有关更多详细信息,您可以参考此博客

以编程方式关闭“继续进行窗口”的唯一方法是通过window.open()打开窗口。例如,如果要通过单击链接打开新窗口,则可以使用以下代码:

<a href="javascript:;" onclick="window.open('test.html', '_blank')">link</a>

然后在 test.html 上使用window.close() >关闭窗口。

If you open the Developer Tools console, you'll find this message when the window doesn't close by window.close():

Scripts may close only the windows that were opened by them.

The message is clear. There're some restrictions when using window.close() to close window. In Chromium, window.close() succeeds if the new window/tab has an opener or if the back/forward stack contains fewer than two entries. The limitation of window.close() is for security and user-experience. For more detailed information, you can refer to this blog.

The only way to close the proceed window programmatically is opening the window by window.open(). For example, if you want to open a new window by clicking a link, you can use the code like below:

<a href="javascript:;" onclick="window.open('test.html', '_blank')">link</a>

Then on test.html you can use window.close() to close the window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文