我正试着用盖茨比实现下面的目标
用户在表单页面上,如果他们按下浏览器后退按钮,就会出现一个弹出,询问他们是否想离开。
如果用户选择ok,那么它将返回。
如果用户选择cancel,那么它将停留在此页面上。
我能够“几乎”通过以下操作来实现这一点
useEffect(() => {
const confirmExit = e => {
const leaveThisPage = window.confirm("Would you like to leave this page?")
if (!leaveThisPage
我需要允许用户点击“页面-1.htm”中的链接并打开弹出窗口。然后,当用户浏览到主浏览器窗口中的"page-2.htm“时,我需要能够引用弹出窗口。
“页面-1.htm”中的JavaScript
var playerWin = window.open("player.htm", "playerWin", "width=300,height=130");
playerWin.play("song.mp3"); // play() is a function in player.htm
“页面-2.htm”中的JavaSc