jquery - beforeunload on Chrome -


I have this code that will redirect the user to any other URL whenever it closes the page. It's working on Firefox, IE, Safari, but not in Chrome. This will not redirect the user to the new URL.

  jQuery (document) .ready (function () {jQuery (window) .bind ('beforeunload', function (e) {location.href = "http: // google Before you leave the .com / "; return", please take a look at this limited time offer. ";});});  

Not sure what you want, it will redirect the user if that option To stay on the page:

  var a, b; Window.onbeforeunload = function (e) {if (b) returns; A = setTimeout (function () {b = true; window.location.href = "http://google.com";}, 500); Return "Before you leave, please take a look at this limited time offer."; } Window.onunload = function () {clearTimeout (a); }  

Comments

Popular posts from this blog

Editing Python Class in Shell and SQLAlchemy -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -

import - Python ImportError: No module named wmi -