6

I am trying to create a custom pop up card when a person try to refresh the browser. I know how to show the pop up alert in the top of the browser using this.

window.onbeforeunload = function() {
    return 'Your upload will be lost if you leave the page, are you sure?';
};

But I want to create a pop up like this when user refresh the page. Can anyone explain me how I can do that. Image

Sinduja
  • 161
  • 11
  • 1
    Does this answer your question? [How can I override the OnBeforeUnload dialog and replace it with my own?](https://stackoverflow.com/questions/276660/how-can-i-override-the-onbeforeunload-dialog-and-replace-it-with-my-own) – Mario Petrovic Nov 30 '21 at 10:52
  • 2
    No @MarioPetrovic. I already tried that. By using onbeforeunload we can't customize the pop up like the image I have added. That's why I am looking for a better solution. – Sinduja Nov 30 '21 at 10:56
  • 1
    There is no way to intercept user with custom message. If this existed i think people would misuse it for ads. – Mario Petrovic Nov 30 '21 at 11:01

0 Answers0