I’m going to have to go down the rabbit hole of making my own website soon. Just curious but would there be an easy way to show a pop up just to people using chrome?
I've been wondering why not window.chrome == true or Boolean(window.chrome), but it turns out that the former doesn't work and that == has essentially no use unless you remember some completely arbitrary rules, and that JS developers would complain that the latter is too long given the fact that I've seen javascript code using !0 for true and !1 for false, instead of just true and false because they can save 2 to 3 characters that way.
== has essentially no use unless you remember some completely arbitrary rules
If you make sure the types match, like by explicitly converting things on the same line on that example, then you can use it just like if it was ===.
In fact, there are people that defend that if your code behaves differently when you switch those two operators, your code is wrong. (Personally, I defend that JS it a pile of dogshit, and you should avoid going to dig there.)
Not sure if serious, but there's a million ways to do this, some that require importing thousands of lines of code and none of which are guaranteed to work in all possible circumstances. But here's a simple one.
Well, some browsers have made User-Agent strings useless. Technically, it's like this:
Firefox: "Mozilla based browser, Gecko engine, Firefox."
Chromium: "We're totally a Mozilla based browser we swear. Also KHTML, which is like Gecko basically. I guess also a bit like WebKit. Has anyone ever heard of those? No? OK. Fine, here's some actual information then..."