Javascript check Opera Mini

So today I got caught on the weird-side of mobile web-development, that is to create consistent javascript on major mobile browsers. The good news is Android and IPhone are using webkit so it’s kind of easy. The Bad News is Opera Mini.

Don’t get me wrong, I love opera mini. But the different java-script engine behavior could cause headache sometimes. After googling for a while I stumbled on this http://dev.opera.com/articles/view/javascript-support-in-opera-mini-4/ that mention some things to consider:

  1. Opera Mini JS has a limited DOM event
  2. No background scripting
  3. Very limited AJAX support

And the most important thing is this snippet to check whether we are inside Opera Mini (of course you can use PHP or Server Side script as a better method)

is_operamini = Object.prototype.toString.call(window.operamini) === "[object OperaMini]";

So to avoid more headache, I just treat opera-mini as a non-javascript-capable browser *smirk*

Advertisements

2 comments

  1. bati · November 12, 2015

    Nice, but can you paste all the code needed to detect opera mini and if so, use special css file to suport it? Thanks.

    • Piet · November 24, 2015

      Yeah, same here, could you please elaborate a bit with the whole snippet or point to a resource that explains this? That would be awesome, thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s