userAgent is deprecated.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/u...
userAgent is deprecated.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/u...
> If you'd rely on feature detection, your critical path for "showing the initial screen of the app" is bound to "download feature detect, parse it, execute it, fetch correct variants of your js/css packages, parse them, execute them, show screen". That's not cool, imho.
Even for barebones web apps, your initial html response should have either empty data (but otherwise a visible UI) or a SSR'd version of the page shown while the JS downloads and executes.
2) With SSR you're actually making a case for sniffing the UA for the client's device class. Web apps might need to ship vastly different but overlapping code across different device classes. I'm not even talking about things that can be lazily loaded subsequently, I'm talking about the initial screen for given URL.
3) I'm _not_ going to show the customer any loading spinner or just show a white page for 2s. We had that with Java Applets, remember?
All in all, I'm not saying we should getting back into optimizing web apps for certain os/browsers/versions. What I'm saying is there might be good reasons where the mess of classifying the device on the (first) Initial Page Request is acceptable, given the alternatives.
I thought you were specifically talking about testing the behavior of your website on different client by changing your browser's UA. The only legitimate use would be if you have a mobile-only stylesheet like older wordpress themes (because you said "I've never come across a better way to get a sneak peek into the (first) Initial Page Request of a customer to your web app")
> 2) With SSR you're actually making a case for sniffing the UA for the client's device class. Web apps might need to ship vastly different but overlapping code across different device classes. I'm not even talking about things that can be lazily loaded subsequently, I'm talking about the initial screen for given URL.
I'm not sure why this would be the case. For Teams, they can just load a purple top bar with the words "Microsoft Teams: Loading", right? That's a single responsive stylesheet.
> 3) I'm _not_ going to show the customer any loading spinner or just show a white page for 2s. We had that with Java Applets, remember?
What else are you going to show while the page loads? A fake UI with fake data? As soon as the JS starts executing and loading data, that data can start to populate the screen.
Yes, and because it does, people will use it. You (or standards) bodies can scream from the top of the mountains that it's deprecated, but it won't matter, because if it's there, it will be used.
2. Use `setInterval` to start your benchmark routine.
3. Benchmark function runs the API using a simple loop that will return quickly (i.e. within 2ms) using performance.now to evaluate.
4. When you obtain enough samples to indicate an alternate path is faster disable the benchmark function
No freezing the browser. Shouldn't take too long to switch to an optimized version.
That being said, this is a lot of complexity / hard to implement in a robust and fast way so I'm not saying it's a better answer.
It wouldn’t surprise me if some junior dev picked it up and then went to ask a senior dev how can they detect the browser version and they got a half assed reply hmm check the user agent and went on with that.
95% of the major bugs and security issues I see on a daily basis are due to this.
But in a more general view reliance on an unreliable and user controlled data for decision making is a pretty common pitfall in the security world.
Web advocates can scream from the rooftops as much as they want that nobody should do UA testing, and then have basically no response when we encounter genuine browser bugs that can't be worked around.
It is still an old FireFox user agent I got somewhere. I should test my code and see if it still works after all these years. At the time, it was the only userAgent string which didn't lead to being limited. It was almost like an invisibility cloak for my bots.
For example, how do you know if calling a API will crash the browser?
https://bugs.chromium.org/p/chromium/issues/detail?id=118336...
It's unlikely they QA unstable browsers, but some in this thread are reporting the same on FF stable.
Bugs in the app can lead to big issues and telling the customers to use whatever browser suits them and "if it works it works" is not good enough. There are still large differences between browsers that feature existence is not same as feature conptivinility.
Of course customers can tweak user agent and "lie" about their browser but then responsibility of issues is shifted to them.
I get all the rest but not this part. A banner should work plenty?
If there are bugs, it may result in money being transfered to the wrong company, or money being transfered without proper approval. Maybe unlikely bugs but could happen.
I can show a banner telling each of the 10k users about browser requirements. I guess that around 99% of the users will ignore that banner and happily proceed with unsupported browsers.
If I don't know if it will work with the browser they are using, why should I let them perform transactions using it? Sure, if it goes wrong maybe I can tell the CFO that their employee ignored the banner, but that won't make him happy.
For me selling the service there are zero benefits with allowing arbitrary browsers.