Saurabh Tewari
Saurabh Tewari

Reputation: 33

How to get page dimensions in JavaScript or GWT

In a web page I need to get the max x and y coordinates.

How this is achieved using JavaScript or with GWT specific code?

Upvotes: 3

Views: 4298

Answers (4)

Craigo
Craigo

Reputation: 3727

To get the size of the browser window, use:

Window.getClientHeight()
Window.getClientWidth()

To get the size of the html page, use:

Document.get().getScrollHeight()
Document.get().getScrollWidth()

Upvotes: 0

Suresh Atta
Suresh Atta

Reputation: 121998

GWT :

import com.google.gwt.user.client.Window;

int height =Window.getClientHeight();
int width =Window.getClientWidth();

Upvotes: 4

Milind Anantwar
Milind Anantwar

Reputation: 82241

you can use scrollHeight and scrollWidth for getting whole page dimension.

var pageheight=document.body.scrollHeight ;
var pageweight=document.body.scrollWidth;

Upvotes: 0

ColinE
ColinE

Reputation: 70142

Look at the Window class, it has methods for getting the client height /width:

Upvotes: 5

Related Questions