Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Screen.orientation

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

Summary

orientation 속성은 화면의 현재 방향을 알려 준다.

Note: 이 함수는 설치된 웹앱 또는 full-screen mode 의 웹페이지에서 동작한다.

Syntax

var orientation = window.screen.orientation;

Return value

리턴값은 화면의 방향을 표현하는 문자열이다. portrait-primary, portrait-secondary, landscape-primary, landscape-secondary 가 될 수 있다. (각 값들에 대해 좀 더 많은 정보를 구하려면 lockOrientation 를 보라.).

Example

var orientation = screen.mozOrientation;

if (orientation === "landscape-primary") {
  console.log("That looks good.");
} else if (orientation === "landscape-secondary") {
  console.log("Mmmh... the screen is upside down!");
} else if (orientation === "portrait-secondary" || orientation === "portrait-secondary") {
  console.log("Mmmh... you should rotate your device");
}

Specifications

Specification Status Comment
Screen Orientation API
The definition of 'Screen Orientation' in that specification.
Working Draft Draft specification

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support Not supported (Yes) moz Not supported Not supported Not supported
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported (Yes) moz Not supported Not supported Not supported

Gecko notes

이 API 는 현재 초안 형태이다. 이것은 오직 B2G 와 안드로이드용 Firefox 에서 prefixed 함수인 (mozOrientation) 로만 구현된다.

See also

문서 태그 및 공헌자

 이 페이지의 공헌자: fscholz, teoli, junho85
 최종 변경: fscholz,