jQuery .unload() issue in Safari -


im dynamically populating image container div, using $.post() function. whenever have different filtering images, abort current request, however, have troubles when navigating page on site. ive realised, should abort current request there well, however, struggles under safari while not under chrome.

initialising request:

var request = $.post( ... ); 

when running one:

request.abort(); request = $.post( ... ); 

when navigating away, page:

$(window).unload(function() { request.abort(); }); 

could there reason why does not work or @ least, not always under safari? thanks!

please take @ question:
why jquery unload not working in chrome , safari?

the unload function not part of standard, can't sure if unload function gets called in browser.

try:

$(window).on('beforeunload ',function() {     request.abort(); }); 

instead.

update

another solution can following. users navigate page links. so, using jquery, update onclick behaviour of links: first abort request, navigate new page.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -