Refresh after modal close?

Add this to Code inside footer of the parent page, not the modal page.

It adds refresh after you click the close modal button (assumes the “Do nothing” action is set for the modal)

window.addEventListener('load', function() {
    setTimeout(function() {
        var e = document.getElementsByClassName("sw-modal-close")[0];
        e.setAttribute('onclick', "MicroModal.close('sw-modal');  location.reload();");
    }, 1600);
});
</script>

PS Some apps need a pause before reload, perhaps to wait for an Airtable automation to complete:
e.setAttribute('onclick', "MicroModal.close('sw-modal'); setTimeout(location.reload.bind(location), 1600);");

1 Like