Reputation: 21
I was trying to detect if a browser supports innerHeight
...
Is there any tag to check browser support for a specific code of JavaScript like that of @supports
in CSS?
Upvotes: 0
Views: 40
Reputation: 26
You can use what you're trying to use in an "if" statement
if(window.innerHeight)
console.log("window.innerHeight supported");
else
console.log("window.innerHeight not supported");
div=document.getElementsByTagName("div")[0];
if(div.innerHeight)
console.log("div.innerHeight supported");
else
console.log("div.innerHeight not supported");
Upvotes: 0
Reputation: 3440
InnerHeight has a 95.22% all-time browser support rating. Pretty sure you're safe using it. :)
https://caniuse.com/#feat=mdn-api_window_innerheight
Upvotes: 2