简体   繁体   English

Confirm()在我的Windows 10 Web应用程序上不起作用

[英]confirm() is not working on my Windows 10 Web App

I am making a Windows 10 Web App (Project Westminster). 我正在制作Windows 10 Web应用程序(威斯敏斯特计划)。 There is a page that requires user to input something, and there's a 'save' button, and another button that leads to another page of the app. 有一个页面需要用户输入某些内容,还有一个“保存”按钮,另一个按钮可通往应用程序的另一个页面。

To prevent user clicking the wrong button and lost his/her data before saving, I implement the JavaScript confirm() method to ask users to confirm before leaving. 为了防止用户单击错误的按钮并在保存之前丢失了他/她的数据,我实现了JavaScript validate()方法,要求用户在离开之前进行确认。

This is working on iOS, Android, or Edge browser on Windows 10, but not on the Windows 10 app. 这适用于Windows 10上的iOS,Android或Edge浏览器,但不适用于Windows 10应用程序。 The prompt does not show up but the page also does not exit, as if the user has already pressed the "stay here" button. 提示不会显示,但页面也不会退出,就好像用户已经按下“ Stay here”按钮一样。

How can I make this work as expected? 如何使这项工作按预期进行? Thanks! 谢谢!

Windows will not let you prevent the closing of an app of the user chooses to, so the best way to handle this would be to save the data on the Suspending event and load it again when the app resumes. Windows不允许您阻止用户选择关闭某个应用程序,因此处理此问题的最佳方法是将数据保存在Suspending事件中,并在应用程序恢复时再次加载。 Here's a sample that might help you get going. 这是一个示例 ,可能会帮助您入门。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM