javascript_browser object

//javascript_browser object

'use strict'
//window represents the current window
console.log('----------------------------window object and its properties------------- ---------------');
console.log('Browser width: ' + window.innerWidth);
console.log('Height in the browser: ' + window.innerHeight);
console.log('Browser outer width: ' + window.outerWidth);
console.log('Height outside the browser: ' + window.outerHeight);

//navigator represents the current browser
console.log('----------------------------navigator object and its properties------------- ---------------');
console.log('appName = ' + navigator.appName);
console.log('appVersion = ' + navigator.appVersion);
console.log('language = ' + navigator.language);
console.log('platform = ' + navigator.platform);
console.log('userAgent = ' + navigator.userAgent);

//screen represents the current device browser
console.log('----------------------------screen object and its properties------------- ---------------');
console.log('screen.width = ' + screen.width);
console.log('screen.height = ' + screen.height);
console.log('screen.colorDepth = ' + screen.colorDepth);

//location represents the current url
console.log('----------------------------location object and its properties------------- ---------------');
console.log('location.protocol = ' + location.protocol);
console.log('location.host = ' + location.host);
console.log('location.port = ' + location.port);
console.log('location.pathname = ' + location.pathname);

//document represents the current page, which is the root node of the DOM tree
console.log('----------------------------document object and its properties------------- ---------------');
document.title = 'Look, the text of the browser tab has changed';
console.log('document object has 1 cookie property: ' + document.cookie);

// history object
// This object is a legacy object. For modern web pages, due to the heavy use of AJAX and page interaction, simply calling history.back() may make users very angry.
// When newbies start designing Web pages, they like to call history.back() when the login page is successfully logged in, trying to return to the page before login. This is a wrong approach.
// Under no circumstances should you use the history object.

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325609999&siteId=291194637
Recommended