• General
    • Home
    • Contact Us
    • Privacy Policy
    • Sitemap
  • Photographs
    • 2018
    • 2017
    • 2016
    • 2015
  • Literature
    • Poems
  • News
    • Announcements
    • Charity
    • Legal
    • Medicine
    • Politics
  • Education
    • Code Samples
      • Basic
      • Simple
      • Intermediate
      • Advanced
      • Tips
    • History
    • Literature
    • Quotes
    • Videos
    • Vocabulary
  • Entertainment
    • Art
    • Humor
    • Photos
    • Video
  • Technology
    • Software
      • Support
      • Tweaks
    • Company
    • Science
    • Security
Major Mike

Knowledge is Power - Share the Power

Display Sizes (Screen vs Available) [BASIC]

September 3, 2015 by GµårÐïåñ

As a programmer, often you need to either know the size of the user’s screen (basically their resolution); or the more important available space inside their browser where you can display your content. You avoid less clipping and display issues if you can distinguish the two.

function getWidth(){
	if(document.all){
        	return document.body.clientWidth;
	}else{
        	return innerWidth;
	}
};

function getHeight(){
	if(document.all){
        	return document.body.clientHeight;
    	}else{
        	return innerHeight;
    	}
};
document.writeln("Screen Size : " + screen.width + " x " + screen.height + " (Includes Everything on Screen)<br/>");
document.writeln("Width: " + getWidth() + " x  Height: " + getHeight() + " (What's Available INSIDE the Browser)");
DEMO | DOWNLOAD
Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail
Posted in: Basic, Education Tagged: basic level, code, JavaScript
← String Reverse [BASIC]
Ivory Ban Moves One Step Closer to Law →

Show Your Support – We Don’t Believe in Disruptive Ads

Donate in one of two ways :
(BitCoin - preferred)
1BTshbqMSx5AHrDFLEa1YdPAy5EFzRSjr9
(PayPal)
September 2015
M T W T F S S
« Aug   Oct »
 123456
78910111213
14151617181920
21222324252627
282930  

Semper Fidelis

Always Faithful, Always Forward
United States Marine Corp

Places to find me:

StackExchange profile for GµårÐïåñ at StackExchange

Google+ ➠

Twitter : verified ➠Follow

GitHub ➠Follow @GuardianMajor

ello ➠

deviantArt profile for GµårÐïåñ on deviantArt

Facebook i have made a personal choice after their "name policy" witch hunt which repeats every 2 years it seems at the whim of the "bully mob" (even when they make you jump through hoops and verify you), to just quit it and be done with it, they are not worth my time. I don't need it, I don't miss it, in fact it has made my life more productive and void of gross hate, vitriol and drivel. To those who say they can't stay in touch if I am not on there, if you can't reach me because I am not on Facebook, then you are not trying AT ALL - therefore, good riddance.

Scribd profile for GµårÐïåñ on Scribd

NoScript/FLashGot (Informaction) profile for GµårÐïåñ on Informaction Forums

Subjects

United States 1939 1889 event 1851 1914 1986 history 1948 1971 1954 1938 1937 1977 1990 1902 1941 1917 1960 1942 daily pic 1919 vocabulary has_audio 1979 1961 1933 1918 1966 1865 1863 1951 1956 1898 1964 1949 1957 1846 annual 1972 has_video 1952 1812 1934 1973 1991 1911 1980 1962 1915 1946 NASA 1970 1978 1950 1908 1955 1983 1963 1789 1870 1995 1968 1953 1859 1947 Soviet Union 1965 1935 1944 memorial 1922 code 1985 Germany 1984 1998 1969 1989 1974 holiday England 1916 1967 New York 1982 1943 1940 1993 2000 1959 1981 1958 1975 1945 national park 1994 1776 1976 1901

Archives

Access Options

  • Log in
  • Entries RSS
  • Comments RSS
  • ∞ Guardian International
🎔
Brought to You
by Guardian International

Copyright © 2007-2019 Major Mike | Privacy Policy | DMCA | Contact | About
fortitudo fortis defendit

McAfee SecureNorton by SymantecVirusTotal