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 […]

The post Detect Browser Bars Visibility with JavaScript appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh

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?

The post Detect Browser Bars Visibility with JavaScript appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh


Print Share Comment Cite Upload Translate Updates
APA

David Walsh | Sciencx (2022-12-30T01:36:35+00:00) Detect Browser Bars Visibility with JavaScript. Retrieved from https://www.scien.cx/2022/12/30/detect-browser-bars-visibility-with-javascript/

MLA
" » Detect Browser Bars Visibility with JavaScript." David Walsh | Sciencx - Friday December 30, 2022, https://www.scien.cx/2022/12/30/detect-browser-bars-visibility-with-javascript/
HARVARD
David Walsh | Sciencx Friday December 30, 2022 » Detect Browser Bars Visibility with JavaScript., viewed ,<https://www.scien.cx/2022/12/30/detect-browser-bars-visibility-with-javascript/>
VANCOUVER
David Walsh | Sciencx - » Detect Browser Bars Visibility with JavaScript. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/12/30/detect-browser-bars-visibility-with-javascript/
CHICAGO
" » Detect Browser Bars Visibility with JavaScript." David Walsh | Sciencx - Accessed . https://www.scien.cx/2022/12/30/detect-browser-bars-visibility-with-javascript/
IEEE
" » Detect Browser Bars Visibility with JavaScript." David Walsh | Sciencx [Online]. Available: https://www.scien.cx/2022/12/30/detect-browser-bars-visibility-with-javascript/. [Accessed: ]
rf:citation
» Detect Browser Bars Visibility with JavaScript | David Walsh | Sciencx | https://www.scien.cx/2022/12/30/detect-browser-bars-visibility-with-javascript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.