Here is a method that is supported by nearly all browsers:
if (sessionStorage.getItem('reloaded') != null) {
console.log('page was reloaded');
} else {
console.log('page was not reloaded');
}
sessionStorage.setItem('reloaded', 'yes'); // could be anything
It uses SessionStorage to check if the page is opened the first time or if it is refreshed.