I am making a website, and I would like to figure out what size the display portion of the browser is.

Here is more of an idea of what I mean

tabs and menu
widgets if they have any
browser window
bottom portion of web browser

I would like to know how to figure out the browser window height.

Thanks for your help.

Recommended Answers

All 4 Replies

Member Avatar for diafol

this is js not php. PHP can't tell.

then could you tell me how to do it with JS?

Member Avatar for diafol

No that's js forum

by doing a google search

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

console.log(getDocHeight());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.