Giter Site home page Giter Site logo

Comments (10)

ondras avatar ondras commented on August 22, 2024

Damn, díky za info. Nějaký tip na spolehlivější detekci? :-)

from jak.

JasnaPaka avatar JasnaPaka commented on August 22, 2024

Nejsem příznivcem podobně konstruovaných detekcí jako výše, protože jsou náchylné na podobné věci, jako se teď stala. Když už bych chtěl detekovat Gecko, asi bych to dělal podle user-agentu:
https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent

Další možností je detekovat podporu nějaké CSS vlastnosti specifické pro Mozillu (ale té, která je dlouhodobě dostupná a nebude se jen tak odstraňovat):
http://stackoverflow.com/questions/8824547/css-property-support-detection
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Mozilla_Extensions

Případně detekovat něčeho z DOMu, co má "moz" prefix. Např. window.mozIndexedDB, ale nikdo zde nezaručí, že to do budoucna bude dostupné. Přecejen, je to používáno jen v době standardizace.

Každopádně bych nechal i tu původní detekci pro zpětnou kompatibilitu.

Ale JavaScriptu v zásadě nerozumím... jako ostatně všemu :)

from jak.

ondras avatar ondras commented on August 22, 2024

Nu, ani my si v této detekci nelibujeme. S ohledem na rozložení tlačítek myši však bylo historicky nutné prohlížeče odlišovat - a použít pro to UA nám přijde ještě horší, než přes nějaké browser-specific věci (UA si uživatelé často podvrhují).

Aktuální řešení bylo skutečně poměrně dlouhodobé (fungovalo od cca Firefoxu 2), takže se poohlížíme po nějakém novém. Primárně ovšem zkusíme ověřit, jestli už by se práce s tlačítky myši nedala sjednotit.

from jak.

ondras avatar ondras commented on August 22, 2024

V API se oprava projeví zanedlouho. Celý koncept JAK.Browser nicméně zvolna opouštíme.

from jak.

bzbarsky avatar bzbarsky commented on August 22, 2024

This fix will just cause the library to break again when mozPaintCount is removed. See http://weblogs.mozillazine.org/bz/archives/2011/03/capability_sniffing_done_wrong.html for an explanation of the problems with this sniffing approach, and a description of the right way to do capability-sniffing....

from jak.

ondras avatar ondras commented on August 22, 2024

@bzbarsky Hi Boris, the comments above are acknowledging the issue you describe as well as stating our plans for futher enhancemets (read: removal) of such detection. Unfortunately, they are in Czech language, so this context is missing for you. Sorry for this and thanks for your comment.

Basically, for historical reasons, the "Browser.client" field shall contain the browser identification ("gecko" for Firefox, which is not precise, but sufficient). We are fully aware about feature detection (as opposed to browser detection), but we need to maintain this code for compatibility reasons. Until we completely refactor all code that relies on the "Browser.client" value (to use feature detection instead), we still need to detect a browser. Doing so by UA sniffing is - IMO - even worse then detecting -moz- values and so on. If you can recommend a better way of detecting gecko, we would appreciate it.

I hope my explanation here is sufficient; please excuse my poor english.

from jak.

bzbarsky avatar bzbarsky commented on August 22, 2024

Your English is way better than my Czech; I tried to read the comments above, but got lost about 1/3 way through.

Actually, detection via UA is probably better than sniffing random non-standard properties if you really want to just detect "Gecko": the UA string is pretty stable....

from jak.

ondras avatar ondras commented on August 22, 2024

@bzbarsky Our users are known to spoof (on purpose or by chance, experimenting with addons and/or malware) the UA; we were receiving quite a number of (not really valid, but...) bugreports for UA-based detections :-(

from jak.

ondras avatar ondras commented on August 22, 2024

@bzbarsky Also, just out of curiosity - how did you came across this issue/commit/repo? :-) This library is virtually unknown outside of .cz ...

from jak.

JasnaPaka avatar JasnaPaka commented on August 22, 2024

See my original bug report in Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=914537

from jak.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.