31
Views
1
Comments
How to create Custom Popup(Alert)?
Question

Hi

I want to perform Custom Alert instead of default.

Whenever user wants to navigate back to previous screen using browser's navigation arrow or if user want to close the browser or tab , at that time I want to show one pop up asking user "Are you sure you want to leave this page?". and based on the user click I want perform action 

Currently I am using JS 

window.addEventListener('beforeunload', function(event) {

    // Cancel the event

    event.preventDefault();

    // Chrome requires returnValue to be set

    event.returnValue = '';

    // Show confirmation dialog

    return confirm('Are you sure you want to leave this page?');

});


 

2024-04-18 08-00-54
Mayur Shrirame

Hi Harbor V,

I have attached the Javascript code image, which is vanilla JS. You can try to implement it in Outsystems. I have attached the CustomJSAlert.oml file too for the reference.

Thanks,

Mayur

JSCustom.png
CustomJSAlert.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.