Regex in Netscape Navigator 9

130 views Asked by At

I have a regex pattern for a telephone number field which allows the user to enter either 10 numbers or 0. I have tested it and confirmed it is working in Google Chrome, Internet Explorer, Firefox, Opera and safari but for some reason it is not working in Netscape Navigator 9. Any help is very much appreciated.

Thank you

pattern="^[0-9]{10}$|^[0-9]{0}$"
1

There are 1 answers

1
Gary On BEST ANSWER

The new trend is to not detect specific browsers, but rather support for the feature you need; in this case "pattern".

var el = document.createElement('input');
var isPatternSupported = (el.pattern === undefined);

alert(isPatternSupported); // Displays `false` for NN9 and `true` for modern browsers