Closed Bug 652103 Opened 14 years ago Closed 14 years ago

window.onbeforeunload return message problem

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 641509

People

(Reporter: anku.gandhi, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0 Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0 Hi, I am using window.onbeforeunload , So when user leave page it ask by showing one message. My code is this : <script language="JavaScript"> var needToConfirm = true; window.onbeforeunload = confirmExit; function confirmExit() { if (needToConfirm) return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?"; } </script> Now When I am running this in Mozilla 4 then it is always asking me like this : "This page is asking you to confirm that you want to leave - data you have entered may not be saved." with two options "Leave page" and "Stay on page". But instead of I think it should ask me my message which i returned - "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?" But it is always promting same message given before. This code working in all other browsers, even in Old mozilla broswers (3.5 ,3.6) but not working in 4. I think it is problem in Mozilla 4, So request to you to solve this if this is a bug. Reproducible: Always Steps to Reproduce: <script language="JavaScript"> var needToConfirm = true; window.onbeforeunload = confirmExit; function confirmExit() { if (needToConfirm) return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?"; } </script> 1. Paste above code in any page. 2. try to use back button or try to close that page. 3. Actual Results: it should ask message which we return, but it is always asking same message. Expected Results: it should ask message which we return, but it is always asking same message.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.