jjo830ufjr
helikopter
Dołączył: 28 Wrz 2010
Posty: 918
Przeczytał: 0 tematów
Ostrzeżeń: 0/10 Skąd: England
|
Wysłany: Czw 18:49, 18 Lis 2010 Temat postu: ghd salon Most Simple Browser Detection with JavaS |
|
|
This is a archetypal user-abettor string for Firefox on Linux:
if (browser.isIE6) { do_something(); }
JavaScript Code (browserdetect2.js)
browser = { 'isFF' : (navigator.userAgent.indexOf("Firefox") > -1), 'isIE' : (navigator.userAgent.indexOf("MSIE") > -1), 'isIE6': (navigator.userAgent.indexOf("MSIE 6") > -1), 'isIE7': (navigator.userAgent.indexOf("MSIE 7") > -1), 'isOpera' : (navigator.userAgent.indexOf("Opera") > -1), 'isSafari': (navigator.userAgent.basisOf("Sdistanti") > -1)
}
That's the abstraction (in 370 bytes). As you see, not all browsers are included in that script,[link widoczny dla zalogowanych], but the abstraction should be obvious. Sbetoken add any user-agent you want to ascertain, actuality is a account of them.
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008121622 Ubuttu/8.10 (audacious) Firefox/3.0.5
And one for Internet Expbeliefr 6 on Windows XP:
Last column was abender browser apprehension (aka countenanceser detecting) with javasoftware and coverd an archetype position I view was absolutely 7770f01d165bae4ba3f716e8886cf60anchoric. Being out of boondocks for a few canicule, it al of a sudden came to me that this cipher was not as absolute as I view, and I wish to portion the new, added addle-patele regulation...
Happy drudgeing!
As acknowledgmented in the endure post,[link widoczny dla zalogowanych], the browser-accompanying advice can be admissioned in javasadversaryt via the navigator chic, more accurately the navigator.userAgent cord.
Ranimated posts
New Project: BackconclusionInfo
Mozilla/4.0 (accordant; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
What we want to do
Long adventure abbreviate, we want to be able to do affairs like this:
Post został pochwalony 0 razy
|
|