I have such situation:
The form is opened on tear-off window
There are unsaved changes
Window is being closed
In these circumstances, I need to display a standard module window,
and if the user clicks "Cancel", then custom confirm window should appear

But in Chrome the icon on the confirm window doesn't appear

On Firefox and on IE the icon appears under the same circumstances.
Code of 'onbeforeunload' event:
window.addEventListener('beforeunload', function (e) {
// function where the confirm window is formed
showConfirmWindow();
return e.returnValue = window.getResource('', 'ex.unsaved_changes');
});
The path to the image is correct because this window is used not only here and the image is displayed. It is only in Chrome and only in such circumstances. I guess that Chrome saves resources because the window closes - so why pull up the icon. But maybe someone knows how to fix it for Chrome?
Additional information: if add timeout on 0 ms for function where the confirm window is formed - the icon is shown
window.addEventListener('beforeunload', function (e) {
// function where the confirm window is formed
setTimeout(showConfirmWindow, 0);
return e.returnValue = window.getResource('', 'ex.unsaved_changes');
});
But this is a bad decision.