Add IE version detection code

This commit is contained in:
Winston Chang
2015-03-16 22:00:23 -05:00
parent 3ac5124e5c
commit a41e1dafc2

View File

@@ -13,11 +13,12 @@
var exports = window.Shiny = window.Shiny || {};
var isQt = false;
var browser = {};
browser.isQt = false;
// For easy handling of Qt quirks using CSS
if (/\bQt\//.test(window.navigator.userAgent)) {
$(document.documentElement).addClass('qt');
isQt = true;
browser.isQt = true;
}
// Enable special treatment for Qt 5 quirks on Linux
@@ -26,6 +27,21 @@
$(document.documentElement).addClass('qt5');
}
// Detect IE information
browser.isIE = (navigator.appName === 'Microsoft Internet Explorer');
browser.IEVersion = getIEVersion();
function getIEVersion() {
var rv = -1;
if (browser.isIE) {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");
if (re.exec(ua) !== null)
rv = parseFloat(RegExp.$1);
}
return rv;
}
$(document).on('submit', 'form:not([action])', function(e) {
e.preventDefault();
});
@@ -563,7 +579,7 @@
if (!/^([$#!&-;=?-[\]_a-z~]|%[0-9a-fA-F]{2})+$/.test(defaultPath)) {
defaultPath = encodeURI(defaultPath);
// Bizarrely, QtWebKit requires us to encode these characters *twice*
if (isQt) {
if (browser.isQt) {
defaultPath = encodeURI(defaultPath);
}
}
@@ -3487,7 +3503,7 @@
uploader.abort();
var files = evt.target.files;
var IE8 = typeof(files) === 'undefined';
var IE8 = (browser.isIE && browser.IEVersion === 8);
var id = fileInputBinding.getId(evt.target);
if (!IE8 && files.length === 0)