最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

JavaScript error on Firefox: TypeError: can't redefine non-configurable property "userAgent" - Stack O

programmeradmin1浏览0评论

I'm currently receiving a weird JavaScript error on my error monitoring tool Sentry that says can't redefine non-configurable property "userAgent".

It seems like the error is happening on multiple pages but only on Firefox. Additionally, on all errors the referrer page seems to be "/".

However, I'm not able to reproduce the error and have no clue whats causing the error as I do not have any assignments to the navigator.userAgent var.

Does anyone else have this issue, too, or has any clue what could cause this error?

I'm currently receiving a weird JavaScript error on my error monitoring tool Sentry that says can't redefine non-configurable property "userAgent".

It seems like the error is happening on multiple pages but only on Firefox. Additionally, on all errors the referrer page seems to be "https://www.startpage./".

However, I'm not able to reproduce the error and have no clue whats causing the error as I do not have any assignments to the navigator.userAgent var.

Does anyone else have this issue, too, or has any clue what could cause this error?

Share Improve this question edited Aug 13, 2021 at 11:53 Wing 9,7314 gold badges42 silver badges52 bronze badges asked Feb 3, 2021 at 18:15 Ferdinand FrankFerdinand Frank 3654 silver badges13 bronze badges 11
  • 1 This one is pretty cryptic. I have it on my app too and its taken me a while to figure out what is going on. Do you happen to be doing any browser detection ? even if you dont have assignments to the navigator.userAgent, are you trying to sniff the browser with it? – Esther Cuan Commented Feb 4, 2021 at 0:52
  • Yes, I actually do have a check on the user agent like this navigator.userAgent === 'native'. I`m setting the user agent within my native app's webview to 'native' to be able to detect whether my website is visited within a normal browser or within a webview of my app. But the errors do not occur while using my native app, just via the Firefox browser. Do you think the check could still cause the issue? – Ferdinand Frank Commented Feb 4, 2021 at 6:58
  • 11 It could be possible that a firefox extension/setting is messing with the user Agent. This article is very useful to explain that we should not be using the userAgent to determine browsers, even mobile. developer.mozilla/en-US/docs/Web/HTTP/… So for me, my guess is that the user has a setting or an extension in firefox that allows them to overwrite their userAgent and perhaps this gets logged into the console because we are using userAgent to derive browser info. – Esther Cuan Commented Feb 4, 2021 at 18:55
  • @EstherCuan Very interesting! Thank you for the information! :) – Ferdinand Frank Commented Feb 5, 2021 at 8:56
  • 4 I got reports of this error in Sentry two time the past months. Firefox 86 and 85, but no clue what the cause is. Very little information provided in the Sentry event. No tickets have been created for this event. I don't use userAgent in the application code, it's used by dependencies so my first step will be to upgrade them. And I'll try to get more information in Sentry. And then we wait

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论