Conceptually if it is, you’ll need to look into it using window.unload which fires when a user is about to leave the page and then keep track of whether page has fully loaded based on dom ready and window loaded events that have fired on the page.
Window.unload: window.unload is basically a jquery event handler. An unload event is sent to the window when a user navigates away from the page. Learn more about window.unload syntax and where to use.
DOM .ready(): The .ready() method basically specifies a function to execute when the DOM is fully loaded. It specifies what happens when a ready event occurs. Jquery Api documentation provides more details about using this method.
window loaded events: The load event is sent to an element when it and all sub-elements have been completely loaded. This event can be sent to any element associated with a URL: images, scripts, frames, iframes, and the window object.