detect and support webkit/ios, fixes #96

This commit is contained in:
rolux 2012-07-11 16:30:31 +02:00
parent 631c5c39c8
commit 518a032325

View file

@ -16,7 +16,7 @@ Ox.load.UI = function(options, callback) {
}, },
{ {
name: 'Chrome', name: 'Chrome',
regexp: /(Chrome|CriOS)\/(\d+)\./, regexp: /Chrome\/(\d+)\./,
url: 'http://www.google.com/chrome/', url: 'http://www.google.com/chrome/',
version: 10 version: 10
}, },
@ -32,6 +32,11 @@ Ox.load.UI = function(options, callback) {
url: 'http://www.apple.com/safari/', url: 'http://www.apple.com/safari/',
version: 5 version: 5
}, },
{
name: 'WebKit',
regexp: /AppleWebKit\/(\d+)\./,
version: 534
},
{ {
name: 'Internet Explorer', name: 'Internet Explorer',
url: 'http://windows.microsoft.com/en-US/internet-explorer/products/ie/home', url: 'http://windows.microsoft.com/en-US/internet-explorer/products/ie/home',
@ -46,7 +51,7 @@ Ox.load.UI = function(options, callback) {
browsers.forEach(function(browser) { browsers.forEach(function(browser) {
var match = browser.regexp && browser.regexp.exec(navigator.userAgent); var match = browser.regexp && browser.regexp.exec(navigator.userAgent);
if (match && match[match.length - 1] >= browser.version) { if (match && match[1] >= browser.version) {
browserSupported = true; browserSupported = true;
} }
}); });
@ -153,6 +158,9 @@ Ox.load.UI = function(options, callback) {
}).join(' '); }).join(' ');
*/ */
div.addClass('OxError'); div.addClass('OxError');
browsers = browsers.filter(function(browser) {
return browser.url;
});
isInternetExplorer ? browsers.pop() : browsers.shift(); isInternetExplorer ? browsers.pop() : browsers.shift();
browsers.forEach(function(browser) { browsers.forEach(function(browser) {
browser.src = Ox.PATH + 'Ox.UI/png/browser' + browser.name.replace(' ', '') + '128.png'; browser.src = Ox.PATH + 'Ox.UI/png/browser' + browser.name.replace(' ', '') + '128.png';