How to detect IE 11 with javascript in Asp.net

后端 未结 10 1908
暖寄归人
暖寄归人 2020-12-01 05:04

Hello I want to detect the Browser , IE 8 or more will be appropriate for me. For this i used following code but it fails for IE 11 . For other its detecting properly.

10条回答
  •  再見小時候
    2020-12-01 05:14

    The 'use feature detection' mantra mystifies me. When you hit a bug, how can you determine what 'feature' is the culprit? Take for example this bit of code:

            $('input[name^=qty]').keyup(function(e) {
                if (this.value.match(/[^0-9\/]*/g)) {
                    this.value = this.value.replace(/[^0-9\/]/g, '')
                }
            });
    

    It removes non-numeric chars from the input field as the user types. Works in FF, Chrome, and Safari. Does not work in ANY version of IE (up to 11, at least): any subsequent bindings on the input field will fail.

提交回复
热议问题