0

As my application is growing in size and complexity, I am adding debugging, logging, tracing and profiling points. I currently have different program switches to turn them off, and a master development swith to turn them all off when in production, and on in development.

It has occurred to me that to prevent accidentally publishing the version with the development mode switch on, I want to turn it off by default in any browser that is not Firefox Developer Edition.

So, How can I determine programatically if browser is Firefox Developer Edition specifically? I have inspected navigator.userAgent but it doesn't provide such information.

PA.
  • 28,486
  • 9
  • 71
  • 95
  • `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0` is current developer userAgent. `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0` is the current "normal" userAgent. – ippi Sep 15 '20 at 01:23
  • I already found this difference in userAgent values, but thought it could be spurious and guessed they will change over time, and might not keep being different, will they? – PA. Sep 15 '20 at 09:37

1 Answers1

0

Maybe a better approach would be to use a query string in the URL, this way you are quite sure only you, or someone who really wants to use the dev mode, is using it.

Kaiido
  • 123,334
  • 13
  • 219
  • 285
  • thanks for the suggestion, but I don't like the idea of "tampering" (pun indented) my browser with third party add ons. In fact I use a similar method for setting my flags, but found it annoying so I came up with a global switch; and then, commiting code at 3am, shit hits the fan. – PA. Sep 14 '20 at 08:27
  • thanks again for this suggestion, it can be indeed convenient in some SPAs. – PA. Sep 15 '20 at 09:38