我正在尝试实现一个代码,当用户点击Logout链接时,必须向用户显示警告消息
This will terminate the session and close the browser. Do you want to continue?
我的网站在IE6和IE7上运行。我已经在下面写了一段代码来实现它。
Sub OnClickLogout()
dim Answer, msg
Msg = "This will terminate the session and close the browser. Do you want to continue?"
Answer = MsgBox(Msg, vbYesNo + vbExclamation, "Warning")
if Answer = vbYes then
window.opener = "y"
window.parent.opener= "x"
window.parent.close
end if
End Sub
我的代码在IE6中工作正常,我的窗口正常关闭。 但是在IE7中,当我点击Yes按钮时,我会收到如下额外消息:
“您正在查看的网页正在尝试关闭该窗口。是否要关闭此窗口?”,选择是和否按钮
我不想要这个额外的消息。我在IE6中也得到了相同的消息,但为此,我搜索并检查你必须设置window.parent.opener = "Some String".
但是这在IE7中不起作用你能否建议我如何在IE7中删除此消息
答案 0 :(得分:0)
您可以尝试这样做以避免IE7中的Microsoft消息: -
window.opener="X"
window.open "","_top"
window.parent.close
我相信它一定会奏效。