Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344749

Summary: [editor] Improve user agent detection code
Product: [ECD] Orion Reporter: Felipe Heidrich <eclipse.felipe>
Component: EditorAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, Silenio_Quarti
Version: unspecified   
Target Milestone: 0.4 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description Felipe Heidrich CLA 2011-05-04 14:31:15 EDT
In the editor we need to improve our agent detection code as it fails, see bug 344710.

The current code is:

var isIE = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent) ? document.documentMode : undefined;
var isFirefox = parseFloat(navigator.userAgent.split("Firefox/")[1] || navigator.userAgent.split("Minefield/")[1]) || undefined;
var isOpera = navigator.userAgent.indexOf("Opera") !== -1;
var isChrome = navigator.userAgent.indexOf("Chrome") !== -1;
var isSafari = navigator.userAgent.indexOf("Safari") !== -1;
var isWebkit = navigator.userAgent.indexOf("WebKit") !== -1;
var isPad = navigator.userAgent.indexOf("iPad") !== -1;
var isMac = navigator.platform.indexOf("Mac") !== -1;
var isWindows = navigator.platform.indexOf("Win") !== -1;
var isLinux = navigator.platform.indexOf("Linux") !== -1;

the user agent string on chrome 11, for example, is 
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.60 Safari/534.24"
Comment 1 Jay Arthanareeswaran CLA 2011-11-07 12:04:59 EST
Created attachment 206537 [details]
Proposed fix

I guess this should take care of the reported problem for Safari. Rearranging the order should do the trick.