How to determine if window.confirm() is supported?

后端 未结 5 2021
小鲜肉
小鲜肉 2021-01-23 06:09

I have a mobile website that is used by various devices including some onboard computers running a locked down version of Windows Embedded 7 with IE 7. For some reason that I ca

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-23 06:35

    How about:

    if ('confirm' in window) {
        $(".logoff").click(function () {
            return window.confirm("Are you sure you want to log off?");
        });
    }
    

    Another options would be window.hasOwnProperty('confirm').

提交回复
热议问题