b134692
b134692

Reputation: 93

browser feature detection with try catch(e)

If a browser don't support Blob(), make the body content "Sorry your browser isn't supported :(".

Is this a good way to do so?

try {
  var isSupported = !! new Blob();
} catch (e) {
  document.body.innerHTML = "<h1>Sorry your browser isn\'t supported :(</h1>";
}

Or you would suggest some other methods.

Upvotes: 0

Views: 105

Answers (1)

Wagner DosAnjos
Wagner DosAnjos

Reputation: 6374

Here is another approach:

if (window.Blob === undefined) {
    document.body.innerHTML = "<h1>Sorry your browser isn\'t supported :(</h1>";
}

Upvotes: 2

Related Questions