Javascript 使用a标记在onclick()事件之后重定向
我正在用elecrtonjs编程一个应用程序,结果卡住了 因此,在我的页面上有以下HTML:Javascript 使用a标记在onclick()事件之后重定向,javascript,html,electron,Javascript,Html,Electron,我正在用elecrtonjs编程一个应用程序,结果卡住了 因此,在我的页面上有以下HTML: <a href="./step1.html" id="next"><span onclick="writeToFile();return false">Next ></span></a`> 代码会正确重定向,但不会将用户输入附加到指定的文件中 我选错时间了吗?我试过了 onbeforeunload 谢谢您的帮助。正如Chris Li所说,您应该使
<a href="./step1.html" id="next"><span onclick="writeToFile();return false">Next ></span></a`>
代码会正确重定向,但不会将用户输入附加到指定的文件中
我选错时间了吗?我试过了
onbeforeunload
谢谢您的帮助。正如Chris Li所说,您应该使用
window.location.href = "./step1.html"
并删除链接的href字段。您可以在WriteFile完成后使用window.location.href=“./step1.html”而不是tag。也许此链接可以帮助您-
window.location.href = "./step1.html"