onunload

Javascript 'onunload' event not working in latest Version '54.0.2840.71 m' of Google Chrome browser

北战南征 提交于 2019-12-06 15:53:43
Recently I updated my Google Chrome browser to Version '54.0.2840.71 m' and suddenly javascript 'onUnload' event has stopped working. I am sure, it was working fine before the upgrade. In my code (mentioned below), I am trying to open a 'Child' window from a 'Parent' window and when the child window is closed/refreshed (i.e. when its unload event is triggered), it should also reload or refresh the parent window. Source code of parent.html file: <!DOCTYPE html> <html lang="en"> <head> <title>Parent Page</title> </head> <body> This is parent page. Click <a href="#" onClick="window.open('child

How can I prevent window.onbeforeunload from being triggered by javascript: href links in IE?

浪尽此生 提交于 2019-12-04 07:46:13
问题 I'm building a fail safe for my form that is going to warn users that if they leave the page their form data will be lost (similar to what gmail does). window.onbeforeunload = function () { if (formIsDirty) { return "You have unsaved data on this form. Don't leave!"; } } The above function works great in firefox, but in IE it is triggered by any href link, even ones that are links to javascript and not other pages. for example.... <a href='javascript:someFunction();'>click</a> I'm wondering

How can i get the destination url of a link on the web page in the javascript onbeforeunload event?

南楼画角 提交于 2019-12-04 06:54:37
问题 Is it possible to capture what link on the web page the user clicked on? Not talking about if they manually entered an url in the address bar or if they clicked on the back button - but an existing link or menu item on the current page. This is for a commercial web page that has a standard header & footer containing links to other pages on the company's web site. They have a complicated order form where it's not practical to try saving & restoring the state of the form. If in the process of

How can I prevent window.onbeforeunload from being triggered by javascript: href links in IE?

落爺英雄遲暮 提交于 2019-12-02 14:41:43
I'm building a fail safe for my form that is going to warn users that if they leave the page their form data will be lost (similar to what gmail does). window.onbeforeunload = function () { if (formIsDirty) { return "You have unsaved data on this form. Don't leave!"; } } The above function works great in firefox, but in IE it is triggered by any href link, even ones that are links to javascript and not other pages. for example.... <a href='javascript:someFunction();'>click</a> I'm wondering if there is any way to get around this, as I do not want the user thinking that they are leaving the

How can i get the destination url of a link on the web page in the javascript onbeforeunload event?

倖福魔咒の 提交于 2019-12-02 13:04:16
Is it possible to capture what link on the web page the user clicked on? Not talking about if they manually entered an url in the address bar or if they clicked on the back button - but an existing link or menu item on the current page. This is for a commercial web page that has a standard header & footer containing links to other pages on the company's web site. They have a complicated order form where it's not practical to try saving & restoring the state of the form. If in the process of filling out an order the customer needs to visit another page on the web site - to review product, etc..

check if changes saved before unload

我的未来我决定 提交于 2019-12-02 06:07:36
问题 I have the following javaScript EDIT: included assignments for cahngesSaved var changesSaved = true; $(document).ready(function () { $(".applyChanges").click(function (e) { e.preventDefault(); var id = (this).id; var dayofweek = document.getElementById("dayofweek" + id).value; var hour = document.getElementById("hour" + id).value; var duration = document.getElementById("duration" + id).value; $.ajax({ url: '@Url.Action("ApplyChanges")', type: 'POST', data: { id: id, dayofweek: dayofweek, hour

check if changes saved before unload

▼魔方 西西 提交于 2019-12-01 23:25:40
I have the following javaScript EDIT: included assignments for cahngesSaved var changesSaved = true; $(document).ready(function () { $(".applyChanges").click(function (e) { e.preventDefault(); var id = (this).id; var dayofweek = document.getElementById("dayofweek" + id).value; var hour = document.getElementById("hour" + id).value; var duration = document.getElementById("duration" + id).value; $.ajax({ url: '@Url.Action("ApplyChanges")', type: 'POST', data: { id: id, dayofweek: dayofweek, hour: hour, duration: duration }, success: function (data) { $('#Calendar').fullCalendar('refetchEvents') $

Get url for the page being opened next in window.onunload event

 ̄綄美尐妖づ 提交于 2019-12-01 21:37:52
Is there a way get the location for page being opened next in the window.onunload event. Best Regards, Keshav No! That would be a security problem. Imagine someone navigating from a porn site to a banking site. The other way round (with the HTTP Referrer header) is already somewhat a headache. Firefox allows to suppress the referrer: Enter about:config in the address bar Search for referer (sic) Set network.http.sendRefererHeader to 0 (Courtesy to http://cafe.elharo.com/privacy/privacy-tip-3-block-referer-headers-in-firefox/ ) The current page cannot and should not know where the user wants to

jQuery ajax call in onunload handler firing AFTER getting the page on a manual refresh. How do I guarantee onunload happens first?

淺唱寂寞╮ 提交于 2019-12-01 21:28:57
I have a situation where on page unload I am firing a request to delete the draft of a user's work. This works fine until a user chooses to refresh the page, whereupon inspecting Chrome's network tab shows that Chrome is loading the new page before the ajax request is actually fired. The result is a new draft is created by the page load, and then deleted right away by the ajax call. Here is basically what I'm doing: window.onbeforeunload = function(){ if (pageUpdated){ return 'Are you sure you want to abandon this draft?'; } } window.onunload = function(){ $.ajax({ async: false, type: 'DELETE'

Problem submitting form on window.unload

僤鯓⒐⒋嵵緔 提交于 2019-12-01 10:57:11
问题 I am having a problem submitting form on window unload if form information has been updated (album.updated = true): window.onunload = function(evnt) { if (album.updated) { var save = confirm('Do you want to save changes?'); if (save) { alert('submitting form...'); document.edit_photos.submit(); } } } It alerts "submitting form" but nothing is saved. But when I do a regular submit with a Save button - it saves information. What could be wrong here? 回答1: You cannot reliably interact with the