![](/style/images/good.png)
![](/style/images/bad.png)
Detect Browser Bars Visibility with JavaScript
source link: https://davidwalsh.name/detect-browser-bars
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Detect Browser Bars Visibility with JavaScript
It's one thing to know about what's in the browser document, it's another to have insight as to the user's browser itself. We've gotten past detecting which browser the user is using, and we're now into knowing what pieces of the browser UI users are seeing.
Browsers provide window.personalbar
, window.locationbar
, and window.menubar
properties, with the shape of { visible : /*boolean*/}
as its value:
if(window.personalbar.visible || window.locationbar.visible || window.menubar.visible) { console.log("Please hide your personal, location, and menubar for maximum screen space"); }
What would you use these properties for? Maybe providing a warning to users when your web app required maximum browser space. Outside of that, these properties seem invasive. What do you think?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK