开发者

onbeforeunload problem in chrome

I have implemented unsaved changes warning before tab out to other page. So I need to save the current form before the page unload. I trigger these functions using onbeforeunload event.

if(confirm(confirm_msg)) {
    save_data_using_ajax_call(url)
}

also I tried

if(confirm(confirm_msg)) {
    document.form_name.submit();
    return 'changes saved';
}

First method working in Firefox, But not in c开发者_如何学Gohrome. In IE8 it get returns before the form has saved. Second method not working in chrome. but works in firefox and IE. Can anyone tell me a consistent way of approach?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜