Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

window.onunload is not working as expected.

  • 2 trả lời
  • 28 gặp vấn đề này
  • 69 lượt xem
  • Trả lời mới nhất được viết bởi BalajiPolisetty7

more options

My Scenario .

On Close of the browser/ tab / refresh the tab we need to execute the piece of code.

All my code is in window.onbeforeunload which used to work in previous version of firefox .

But with the latest version code is executing only on closing the tab but not in the browser close or refresh . So i kept return statement in the window.onbeforeunload and all the code in the window.onunload . Now on click on the Leave this page it should call window.onunload and execute the code but in firefox it is not working like this. can you please provide me work around or solution for this.

Thanks alot.

My Scenario . On Close of the browser/ tab / refresh the tab we need to execute the piece of code. All my code is in window.onbeforeunload which used to work in previous version of firefox . But with the latest version code is executing only on closing the tab but not in the browser close or refresh . So i kept return statement in the window.onbeforeunload and all the code in the window.onunload . Now on click on the Leave this page it should call window.onunload and execute the code but in firefox it is not working like this. can you please provide me work around or solution for this. Thanks alot.

Giải pháp được chọn

Call Firefox using a batch file, and have your code in the batch after Firefox.

Đọc câu trả lời này trong ngữ cảnh 👍 1

Tất cả các câu trả lời (2)

more options

Giải pháp được chọn

Call Firefox using a batch file, and have your code in the batch after Firefox.

more options

please suggest if any other approaches we cannot use the suggested approach... or please let us know if this is bug in latest version so that will wait till it get resolved ... thanks