我有一个带有Flash插件的页面。如果我在该页面上,如果用户不保存而不保存它,我不想发布消息......:
if(/containers/.test(document.location.href)){
window.onbeforeunload = function(){
return exit_text;
};
}
这样可以正常工作,除非我将内容保存在Flash插件中。在那种情况下,我不想显示该消息。如何检测onbeforeunload方法中的url?这样我就可以决定何时发布方法!
由于 马库斯
答案 0 :(得分:0)
如果您希望显示提示,则仅在onbeforeunload函数中返回一个值:
window.onbeforeunload = function() {
if(/containers/.test(document.location.href)
return exit_test;
}
如果您想查看目的地网址,那就太不方便了。但是,当用户单击将到达该URL的链接然后检查该变量时,您仍然可以设置变量。