Javascript ionic 2-未捕获类型错误:无法读取属性';1';空的
我注意到,如果我在Javascript ionic 2-未捕获类型错误:无法读取属性';1';空的,javascript,ionic2,Javascript,Ionic2,我注意到,如果我在iphone5、iphone6、ipad或ipadpro上使用Chrome,我的ionic 2会出现此错误: kernel.js:281未捕获类型错误:无法读取null的属性“1” 这显然是由这句话引起的: ... ver: (navigator.appVersion.match('Chrome/([0-9\.]+)') || navigator.userAgent.match('Firefox/([0-9\.]+)'))[1],///<---[1] is the i
iphone5
、iphone6
、ipad
或ipadpro
上使用Chrome
,我的ionic 2
会出现此错误:
kernel.js:281未捕获类型错误:无法读取null的属性“1”
这显然是由这句话引起的:
...
ver: (navigator.appVersion.match('Chrome/([0-9\.]+)') ||
navigator.userAgent.match('Firefox/([0-9\.]+)'))[1],///<---[1] is the issue
...
。。。
版本:(navigator.appVersion.match('Chrome/([0-9\.]+)))|
navigator.userAgent.match('Firefox/([0-9\.]+)))[1],///如果没有匹配项,JavaScriptString.match()
函数将返回null,因此在您的情况下,如果userAgent不是Firefox。除了Android上的Chrome或FireFox之外,其他浏览器上也会出现同样的错误。你需要检查一下
编辑:
iOS上的Chrome在导航器中没有标记为“Chrome”,而是标记为“CriOS”。请参阅:如果没有匹配项,JavaScriptString.match()
函数将返回null,因此在您的情况下,如果useragent不是FireFox,则返回null。除了Android上的Chrome或FireFox之外,其他浏览器上也会出现同样的错误。你需要检查一下
编辑:
iOS上的Chrome在导航器中没有标记为“Chrome”,而是标记为“CriOS”。见: