Opened 9 years ago

Closed 9 years ago

#17582 closed defect (duplicate)

Opera browser is not detected correctly.

Reported by: [email protected] Owned by:
Priority: undecided Milestone: tbd
Component: General Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:


Ver. 1.9.1. Due to navigator.userAgent change in recent versions of Opera, DOJO does not recognize it correctly any more. Now, the userAgent string looks like:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit?/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36 OPR/18.0.1284.49

and is recognized by DOJO as "Chrome" version 31.

I use a workaround for this:

Opera detection

var isOpera = navigator && navigator.userAgent && navigator.userAgent.match(/Opera|OPR\) ? true : false; if (isOpera && !dojo.isOpera) {

window.console.log("PATCHING DOJO: Opera detection, setting dojo.isOpera object."); var idxO1 = navigator.userAgent.indexOf("Opera"); var idxO2 = navigator.userAgent.indexOf("OPR"); var versionString = ""; if (idxO1 > 0) {

versionString = navigator.userAgent.substring(idxO1 + 6);

} else if (idxO2 > 0) {

versionString = navigator.userAgent.substring(idxO2 + 4);

} var spc = versionString.indexOf(" "); if (spc >= 0) {

versionString = versionString.substring(0, spc);

} if (dojo.isAndroid)

delete dojo.isAndroid;

if (dojo.isMozilla)

delete dojo.isMozilla;

if (dojo.isIE)

delete dojo.isIE;

if (dojo.isFF)

delete dojo.isFF;

if (dojo.isChrome)

delete dojo.isChrome;

if (dojo.isSafari)

delete dojo.isSafari;

dojo.isOpera = versionString;


Change History (1)

comment:1 Changed 9 years ago by bill

Resolution: duplicate
Status: newclosed

Duplicate of #17498.

Note: See TracTickets for help on using tickets.