Check if JavaScript is enabled

Posted 2 years ago

<noscript>
<style>
.heads-up{
  color: #31708f;
  background-color: #d9edf7;
  border-color: #bce8f1;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid transparent;
  border-radius: 4px;
}
</style>
<div class="heads-up">
JavaScript is disabled
</div>
</noscript>

There’s no absolute fool proof way of checking JS, you can check cookies, meta refresh to another page etc, however this works best for me. If JS is disabled it will product the below output.