Automatic modal closure after button pressed on it

Here it is @dcoletta

<script>
window.addEventListener('load', function() {
  var intervalSet = setInterval(function() {
    var e = document.getElementsByClassName("sw-modal-close")[0];
    if (e) {
      e.setAttribute('onclick', "MicroModal.close('sw-modal');  location.reload();");
      clearInterval(intervalSet);
    }
  }, 100);
});
</script>
5 Likes