detect_reload() function will produce a message if webpage is reloaded by user. 
What should be code for detect_reload() function?   
function detect_reload()
    {
    }
detect_reload() function will produce a message if webpage is reloaded by user. 
What should be code for detect_reload() function?   
function detect_reload()
    {
    }
 
    
    Check the following link. https://stackoverflow.com/a/10400239/3184797 It has stated that
If it is refreshing, window.onunload will fire.
// From MDN
window.onunload = unloadPage;
function unloadPage()
{
    alert("unload event detected!");
}
https://developer.mozilla.org/en/DOM/window.onunload
If you just want a confirmation box to allow them to stay, use this:
window.onbeforeunload = function() {
    return "Are you sure you want to navigate away?";
}
 
    
     
    
    When the page HAS been reloaded, not before:
Maybe you could use document.referrer for this?
$(function() {
   if(document.referrer === "") {
      //Your code here
   }
});
