Google Chrome detection
Reported by Damien Carol | September 3rd, 2008 @ 03:28 PM | in 1.6.1
I don't know if any patch will be release due to chrome release.
May I suggest this little modification :
at line 18 :
Browser: {
IE: !!(window.attachEvent && !window.opera),
Opera: !!window.opera,
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
},
Could be :
Browser: {
IE: !!(window.attachEvent && !window.opera),
Opera: !!window.opera,
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/),
==> Chrome: !!navigator.userAgent.match('Chrome');
},
With this modification it will be possible to detect if the browser is Chrome with that :
if (Prototype.Browser.Chrome)
{
foo();
}
Comments and changes to this ticket
-
Juriy Zaytsev September 3rd, 2008 @ 08:59 PM
- → Milestone changed from to 1.6.1
- → State changed from new to enhancement
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Prototype JavaScript library.
