how to know when a reload in javascript code example Example: refresh window js window.location.reload();