开发者

onbeforeunload problem in chrome

开发者 https://www.devze.com 2023-03-04 22:53 出处:网络
Ihave 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.

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

精彩评论

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