Determining a Browser’s Dimensions with Javascript
This is about as cross-browswer compatible as you can get:
<script type="text/javascript">
var winW, winH;
if (self.innerWidth) {
winW = self.innerWidth;
winH = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientWidth) {
winW = document.documentElement.clientWidth;
winH = document.documentElement.clientHeight;
} else if (document.body) {
winW = document.body.clientWidth;
winH = document.body.clientHeight;
}
</script>
No comments yet.
Leave a comment
-
Recent
- Highlighting a GridView Row When Clicking a CheckBox
- Determining a Browser’s Dimensions with Javascript
- Executing Server-side Code from JavaScript
- Wrapping ASP.NET AJAX TabContainer Tabs
- Handling Multiple Asynchronous Postbacks
- Disabling a Trigger Control During Asynchronous PostBack
- Maintain Scroll Position after Asynchronous Postback
- Selecting an AJAX AccordionPane by ID
- Easy SQL “If Record Exists, Update It. If Not, Insert It.”
- View Source Trick for Pages with Partial Rendering
- Controlling the ASP.NET Timer Control with JavaScript
- A Client-side Ajax Login for ASP.NET
-
Links
-
Archives
- January 2008 (3)
- December 2007 (4)
- November 2007 (6)
-
Categories
-
RSS
Entries RSS
Comments RSS