Skip to content Skip to sidebar Skip to footer

Detecting Canvas Text API Support (Opera Mini)

Although Opera Mini does not display canvas text, a typical test indicates that it has an implementation of the text API functions. Is there an alternative technique to check for s

Solution 1:

You can use a custom build of the Modernizr library to do that!

http://modernizr.com/


Solution 2:

As I was using canvas to detect fonts, with errors thrown, a more compact alternative I found is:

var canvasTextSupported = function() {
  var cvs = document.createElement("canvas");  
  var ctx = cvs.getContext("2d");
  return 'measureText' in ctx && ctx.measureText("") !== undefined;
}

Firefox 3.0.x doesn't have measureText. And in Opera Mini measureText() returns undefined.


Solution 3:

You can use canisuse.js script to detect if your browsers supports canvas text API or not

caniuse.canvasTextApi();

Post a Comment for "Detecting Canvas Text API Support (Opera Mini)"