JavaScript - How can i tell Browser Chrome, Firefox, Safari, to allow me to have the refresh button disabled?

前端 未结 1 1348
[愿得一人]
[愿得一人] 2020-12-21 14:13

I have logical application running where i need to store the var algorithmToApply=1 or etc;

Where each of my value has relative algorithm assigned. The

相关标签:
1条回答
  • 2020-12-21 14:35

    That is not possible.

    You can, however, add a beforeunload listener which prompts for confirmation:

    var algorithmToApply = 0;
    window.onbeforeunload = function() {
        if (algorithmToApply !== 0) { /* Anything ..*/
            return 'A task is pending. Do you really want to leave?';
        }
    };
    
    0 讨论(0)
提交回复
热议问题