how to detect refresh in javascript code example Example: refresh javascript location.reload(); Works like refresh button.