【问题标题】:Angular 6 - Chrome in IOS - Router problemAngular 6 - IOS中的Chrome - 路由器问题
【发布时间】:2019-03-17 23:50:18
【问题描述】:

我正在开发一个 Angular 6 网站,我只在 IOS(iPad、iPhone)中的 Chrome 上遇到了一个奇怪的问题。

直接转到每个链接时,每个页面都会正确呈现。但是当我点击任何页面内的任何链接时,它会生成一个 NavigationError ,如下所示:

TypeError: Argument 1 ('other') to Node.contains must be an instance of Node
TypeError: Argument 1 ('node') to Node.insertBefore must be an instance of Node

在 IOS 内部调试 Chrome 真的很困难,所以很难获得更多信息。

我的网站在任何其他浏览器和操作系统、Firefox(windows、linux)、Chrome(windows 和 linux)、Safari(ios、osx、windows)上运行良好。

有人知道从哪里开始寻找吗?

谢谢!

【问题讨论】:

    标签: ios angular google-chrome google-cast angular-router


    【解决方案1】:

    显然,当此代码存在时,问题仅在 Google Chrome iOS 上发生:

    let script = window['document'].createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1');
    window['document'].body.appendChild(script);
    window['__onGCastApiAvailable'] = function (isAvailable) { /*Do chromecast initialization*/}
    

    所以我添加了这个条件:

    if(!navigator.userAgent.match('CriOS'))
    

    问题已解决。

    我真的不知道为什么 cast 框架会破坏角度路由。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-06
      • 2019-01-09
      • 2019-03-22
      • 2018-11-19
      • 1970-01-01
      • 2023-03-08
      • 2019-03-14
      • 1970-01-01
      相关资源
      最近更新 更多