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

后端 未结 5 2027
小鲜肉
小鲜肉 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:17

    You could do

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

提交回复
热议问题