Bug Tracker

Modify

Ticket #6716 (closed bug: invalid)

Opened 4 years ago

Last modified 2 years ago

Jquery 1.3.2 -> 1.4.2 unload event problem

Reported by: dfsramos Owned by:
Priority: Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: jquery unload 1.4.2 Cc:
Blocking: Blocked by:

Description

I'm currently developing a webapplication. I was using Jquery 1.3.2 and everything went smoothly. For plugin usage I had to change to version 1.4.2, but when doing so some of the pages on my webapplication somehow caught a problem. When I try to leave them they ALWAYS show the "Are you sure you want to navigate away from this page?" message.

Maybe this isn't quite a bug, but I would like to know which part of the jquery code is doing this so I could try and attempt a fix.

Thanks in advance.

Attachments

leavepagealert.png Download (6.9 KB) - added by dfsramos 4 years ago.

Change History

Changed 4 years ago by dfsramos

comment:1 in reply to: ↑ description Changed 4 years ago by dfsramos

Replying to dfsramos:

I'm currently developing a webapplication. I was using Jquery 1.3.2 and everything went smoothly. For plugin usage I had to change to version 1.4.2, but when doing so some of the pages on my webapplication somehow caught a problem. When I try to leave them they ALWAYS show the "Are you sure you want to navigate away from this page?" message.

Maybe this isn't quite a bug, but I would like to know which part of the jquery code is doing this so I could try and attempt a fix.

Thanks in advance.

I kind of solved the problem myself. But I think this shouldn't be quite a solution.

I was binding a function to the $(window).bind("beforeunload"....

And in it I was doing "return true;"

I think jquery was taking "true" as a response and using it to confirm me leaving the page (hence, chrome was alerting "true" instead of the firefox default "Are you sure you want to leave this page").

My solution was removing the "true" and simply do "return;"

But I think this bit of jquery needs a litle tweaking!

Cheers

comment:2 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

As documented, the unload events are not supported by jQuery; attach them directly to the window object.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.