How to Reload Page When Default ❌ Close Icon is Clicked in GlideModal?

akanksha99
Tera Contributor

I’m using a GlideModal in my UI script to show a popup with some inline HTML content (using renderWithContent). Here's the code:

function showModal(cTitle, htmlContent) {
var gm = new GlideModal();
gm.setTitle(cTitle);
gm.setPreference('focustrap', true);
gm.renderWithContent(htmlContent);
}

I want the page to reload automatically when the user clicks the default (close icon) on the modal.

I tried this, but it doesn’t work:

gm.onClose = function() {
location.reload();
};

Since I’m not using a UI Page or custom modal, just renderWithContent, how can I detect that the button was clicked and reload the page in that case?

Any ideas or solutions would be appreciated.

Thanks!

0 REPLIES 0