Comments (10)
Damn, díky za info. Nějaký tip na spolehlivější detekci? :-)
from jak.
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.
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.
V API se oprava projeví zanedlouho. Celý koncept JAK.Browser nicméně zvolna opouštíme.
from jak.
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.
@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.
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.
@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.
@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.
See my original bug report in Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=914537
from jak.
Related Issues (16)
- timekeeper fix HOT 1
- lightbox: pri width:100% se rozbije autoscale obrazku
- lightbox: podporovat procentuelni rozmery pro #lightbox
- imagecroppator: Resize velkeho obrazku pro jednodussi vyber cropu
- Refactoring ondomready HOT 1
- Refactoring JAK.Events HOT 1
- Refactoring JAK.DOM HOT 3
- Skryvani uploaderu pro IE 8 HOT 1
- Array.isArray HOT 5
- JAK.DOM.getPosition nefunguje správně. HOT 3
- Nefunguje výběr podle hodnoty v JAK.SuperSelect ve verzi s checkboxy
- Widget AndroidAppPromotion - CSS bugy
- JAK.Tooltip - chyba při scrolavání elementu HOT 3
- Add childIndex property HOT 4
- polyfill classList toggle nepodporuje druhý parametr HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jak.