androidopera-mini

Detecting versions of Opera Mini Extreme Mode with Javascript


It seems that "Extreme Mode" in Opera Mini is different from device to device, even with the same Opera Mini version background-size (for example) works on the iPhone with Extreme Mode, or on the Opera Mini Java emulator app, but not on Android 5 with Extreme Mode.

I've looked at the official documentation (https://dev.opera.com/articles/opera-mini-and-javascript/) but it does not provide information on this.

I would like to be able to differentiate between these obviously different modes.

Right now I'm using this script to detect Opera Mini modes, but isOperaExtreme is true both for the iPhone and Android. I want to use text fallback for when background size doesn't work.

// start opera detect
// Check if current browser is Opera
var isOpera = window.opera | window.opr | ( navigator.userAgent.indexOf(' OPR/') > -1 ) | ( navigator.userAgent.indexOf(' Coast/') > -1 ) | ( navigator.userAgent.indexOf(' OPiOS/') > -1 );

// Check if the Opera browser is Opera Mini or Opera Mobile in regular mode (called High Savings Mode)
var isOperaHigh = (navigator.userAgent.indexOf('OPR/') > -1) && (navigator.userAgent.indexOf('Mobile') > -1) && (navigator.userAgent.indexOf('Presto/') < 0);

// Check if the Opera browser is Opera Mini in Extreme Savings Mode
  var isOperaExtreme = (navigator.userAgent.indexOf('Opera Mini/') > -1) && (navigator.userAgent.indexOf('Presto/') > -1);
// end opera detect

$('#opera-detection-1').html('isOpera: ' + isOpera);
$('#opera-detection-2').html('isOperaHigh: ' + isOperaHigh);
$('#opera-detection-3').html('isOperaExtreme: ' + isOperaExtreme);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="opera-detection-1">

</div>
<div id="opera-detection-2">

</div>
<div id="opera-detection-3">

</div>


Solution

  • Use window.operamini field. It's legal.

    window.operamini available only in extreme mode(full compression), because without full compression Opera Mini uses default browser engine. High Savings Mode just effects on content like images, video and etc.