There are some functions that I would like to use in my JavaScript code, but a few of them aren't supported on all browsers. Is there a way to check if the function is available in JavaScript?
For example:
/* context.measureText().actualBoundingBoxAscent is
not supported in Internet Explorer but is on almost
every other browser. */
if (variableExists(ctx.measureText('').actualBoundingBoxAscent)) == true) {
// do code that uses actualBoundingBoxAscent
}
else {
// do back up code if actualBoundingBoxAscent doesn't exist
}