Skip to content

An HTML-form-based hack which confirms whether the page has been refreshed or hard reloaded

Notifications You must be signed in to change notification settings

RouninMedia/confirmHardReload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

confirmHardReload

An HTML-form-based hack which confirms whether the page has been refreshed or hard reloaded

HTML

<form class="my-form">
 <input class="my-input" type="text" />
</form>

CSS

.my-form {
  display: none;
}

JS

const confirmHardReload = () => {

  let hardReload = (document.querySelector('.my-input').value === '') ? true : false;

  if (hardReload === true) {

    document.querySelector('input').value = Date.now();

    console.log('This page has been hard reloaded');
  }

  else {

    console.log('This page has been refreshed');
  }
}

About

An HTML-form-based hack which confirms whether the page has been refreshed or hard reloaded

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published