Select Chapter ❯
JavaScript Tutorial
Javascript Browser
You can get different broswer properties from different javascript objects
Window Object
With the help window object you can get different properties of window.
- window.innerHeight it is used to give the inner height of the browser window
- window.innerWidth it is used to give the inner width of the browser window
- window.open() it is used to open a new window
- window.close() it is used to close the current window
- window.moveTo() it is used to move the current window
- window.resizeTo() it is used to resize the current window
Example of Window Object
Screen Object
With the help screen object you can get different properties of screen.
- screen.width it is used to give the width of the screen.
- screen.height it is used to give the height of the screen.
- screen.availWidth it is used to give the available width of the screen.
- screen.availHeight it is used to give the available width of the screen.
- screen.colorDepth it is used to give the color depth of the screen.
- screen.pixelDepth it is used to give the pixel depth of the screen.
Example of Screen Object
Location Object
With the help location object you can get different properties of location and user.
- window.location.href it returns the URL of the current page
- window.location.hostname it returns the domain name of the web host
- window.location.pathname it returns the path and filename of the current page
- window.location.protocol it returns the web protocol used like http or https
- window.location.assign it loads a new document
Example of Location Object
Browser History Object
With the help browser history object you can get forward and backward url from the history list.
- history.back() it gives the previous url from the history list
- history.forward() it gives the next url from the history list
Example of Location Object
var v = history.forward(); document.write(v); or window.history.forward();//It redirect the user to the next page.