Reputation: 292
When downloading something in Chrome, it shows a download bar that contains all the downloads. how to get download bar height at the bottom of Google Chrome using javascript?
I've tried window.outerHeight - window.innerHeight
but the result is containing the menu bar, status bar, download bar, and the other bars.
how can I get only the bottom download bar?
Thanks in advance
Upvotes: 3
Views: 1827
Reputation: 31903
You can't get that piece of information. The browser will not disclose how much of the window.outerHeight - window.innerHeight
is occupied by what. The image from the MDN page for Window.innerHeight shows it clearly:
Upvotes: 2
Reputation: 718
Before any downloads occur in your app, window.innerHeight
represents the height of the viewport.
After the download, window.innerHeight
represents the height of the viewport plus the download bar.
So just subtract one from the other.
const heightBefore = window.innerHeight;
// code to handle downloads, e.g. click event listener
const heightAfter = window.innerHeight;
const heightOfDownloadBar = heightAfter - heightBefore;
There's no internal method so that's your best bet for a workaround.
Upvotes: 1