-
Task
-
Resolution: Unresolved
-
Minor
-
None
-
3.1.11, 3.2.1
The browser identification in editor.js relies on user-agents string. That detection method is highly unreliable, since many browsers can offer the ability to falsify that string.
Here are two outdated pieces of code from editor.js :
var clientPC = navigator.userAgent.toLowerCase(); // Get client info |
var clientVer = parseInt(navigator.appVersion, 10); // Get browser version |
|
var is_ie = ((clientPC.indexOf('msie') !== -1) && (clientPC.indexOf('opera') === -1)); |
var is_win = ((clientPC.indexOf('win') !== -1) || (clientPC.indexOf('16bit') !== -1)); |
if ((clientVer >= 4) && is_ie && is_win) { |
// Get text selection
|
theSelection = document.selection.createRange().text;
|
I suggest to replace them by...
var is_ie = ((typeof document.all !== 'undefined') && (typeof window.opera === 'undefined')); |
if (document.all && document.uniqueID) { |
// Get text selection
|
theSelection = document.selection.createRange().text;
|
The variables clientPC, clientVer and is_win are no longer needed.
The new definition of is_ie and the condition target the same browsers than previously (IE10 or older + IE11 in compatibility mode) by checking the presence of the nonstandard document.all object (not available in IE11 in standard mode, just like the string 'msie') and the other nonstandard object, document.uniqueID, is specific for IE in Windows.