Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344749 - [editor] Improve user agent detection code
Summary: [editor] Improve user agent detection code
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Editor (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.4 M1   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-04 14:31 EDT by Felipe Heidrich CLA
Modified: 2011-12-01 17:00 EST (History)
2 users (show)

See Also:


Attachments
Proposed fix (1.78 KB, patch)
2011-11-07 12:04 EST, Jay Arthanareeswaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.