본문 바로가기

Javascript

Javascript Browser BOM

BOMBrowser Object Model의 약자이다

 

window : 브라우저 윈도우

  • window.innerHeight - the inner height of the browser window (in pixels)
  • window.innerWidth - the inner width of the browser window (in pixels)
  • window.open() - open a new window
  • window.close() - close the current window
  • window.moveTo() - move the current window
  • window.resizeTo() - resize the current window

window.screen : 유저 스크린에 대한 정보

  • screen.width
  • screen.height
  • screen.availWidth : 유저 스크린 너비 -(minus) 윈도우 태스크바 같은 인터페이스
  • screen.availHeight : 유저 스크린 높이 -(minus) 윈도우 태스크바 같은 인터페이스
  • screen.colorDepth
  • screen.pixelDepth

window.location : 현재 페이지 주소(URL)를 가져오고 브라우저를 새 페이지로 리디렉션하는 데 사용

  • window.location.href returns the href (URL) of the current page
  • window.location.hostname returns the domain name of the web host
  • window.location.pathname returns the path and filename of the current page
  • window.location.protocol returns the web protocol used (http: or https:)
  • window.location.assign() loads a new document
  • window.location.port returns the number of the internet host port (of the current page).

window.history : 브라우저 히스토리를 가지고 있다

  • history.back() - same as clicking back in the browser
  • history.forward() - same as clicking forward in the browser

window.navigator : 방문자 브라우저에 대한 정보를 가진다

  • navigator.appName
  • navigator.appCodeName
  • navigator.platform
  • navigator.cookieEnabled
  • navigator.product  
  • navigator.userAgent  
  • navigator.language 
  • navigator.onLine 
  • navigator.javaEnabled() 

 

Popup Boxes

  • window.alert() method can be written without the window prefix.
  • window.confirm() method can be written without the window prefix.
  • window.prompt() method can be written without the window prefix.

Timing Events

  • setTimeout(function, milliseconds) Executes a function, after waiting a specified number of milliseconds.
  • setInterval(function, milliseconds)  Same as setTimeout(), but repeats the execution of the function continuously.
  • clearTimeout() method stops the execution of the function specified in setTimeout().
  • clearInterval() method stops the executions of the function specified in the setInterval() method.

Cookies

document.cookie : 쿠키를 생성,읽기, 삭제 할 수 있다

setCookie : 쿠키 셋

'Javascript' 카테고리의 다른 글

Javascript AJAX  (0) 2020.07.29
Javascript Form & HTML DOM  (0) 2020.07.28
Javascript  (0) 2020.07.27