mozilla
Your Search Results

    window

    この文書は翻訳中です。他国語のままの部分などがあるのはその為です。
    是非お気軽に MDN に登録して翻訳に参加し、私たちの手助けをして下さい!

    This section provides a brief reference for all of the methods, properties, and events available through the DOM window object. The window object implements the Window interface, which in turn inherits from the AbstractView interface. Some additional global functions, namespaces objects, and constructors, not typically associated with the window, but available on it, are listed in the JavaScript Reference.

    The window object represents the window itself. The document property of a window points to the DOM document loaded in that window. A window for a given document can be obtained using the document.defaultView property.

    In a tabbed browser, such as Firefox, each tab contains its own window object (and if you're writing an extension, the browser window itself is a separate window too - see Working with windows in chrome code for more information). That is, the window object is not shared between tabs in the same window. Some methods, namely window.resizeTo and window.resizeBy apply to the whole window and not to the specific tab the window object belongs to. Generally, anything that can't reasonably pertain to a tab pertains to the window instead.

    プロパティ

    window.applicationCache
    An OfflineResourceList object providing access to the offline resources for the window.
    window.closed
    This property indicates whether the current window is closed or not.
    window.Components
    The entry point to many XPCOM features. Some properties, e.g. classes, are only available to sufficiently privileged code.
    window.console
    Returns a reference to the console object providing access to the browser's debugging console.
    window.content and window._content
    Returns a reference to the content element in the current window. The variant with underscore is deprecated.
    window.controllers
    Returns the XUL controller objects for the current chrome window.
    window.crypto
    Returns the browser crypto object.
    window.defaultStatus 廃止 Gecko 23
    Gets/sets the status bar text for the given window.
    window.dialogArguments
    Gets the arguments passed to the window (if it's a dialog box) at the time window.showModalDialog() was called. This is an nsIArray.
    window.directories
    Synonym of window.personalbar
    window.document
    Returns a reference to the document that the window contains.
    window.frameElement
    Returns the element in which the window is embedded, or null if the window is not embedded.
    window.frames
    Returns an array of the subframes in the current window.
    window.fullScreen
    This property indicates whether the window is displayed in full screen or not.
    window.globalStorage 廃止 Gecko 13
    Unsupported since Gecko 13 (Firefox 13). Use window.localStorage instead.
    Was: Multiple storage objects that are used for storing data across multiple pages.
    window.history
    Returns a reference to the history object.
    window.innerHeight
    Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
    window.innerWidth
    Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
    window.length
    Returns the number of frames in the window. See also window.frames.
    window.location
    Gets/sets the location, or current URL, of the window object.
    window.locationbar
    Returns the locationbar object, whose visibility can be toggled in the window.
    window.localStorage
    Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
    window.menubar
    Returns the menubar object, whose visibility can be toggled in the window.
    window.messageManager
    Returns the message manager object for this window.
    window.mozAnimationStartTime
    The time in milliseconds since epoch at which the current animation cycle began.
    window.mozInnerScreenX
    Returns the horizontal (X) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel in nsIDOMWindowUtils for a conversion factor to adapt to screen pixels if needed.
    window.mozInnerScreenY
    Returns the vertical (Y) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel for a conversion factor to adapt to screen pixels if needed.
    window.mozPaintCount
    Returns the number of times the current document has been rendered to the screen in this window. This can be used to compute rendering performance.
    window.name
    Gets/sets the name of the window.
    window.navigator
    Returns a reference to the navigator object.
    window.opener
    Returns a reference to the window that opened this current window.
    window.outerHeight
    Gets the height of the outside of the browser window.
    window.outerWidth
    Gets the width of the outside of the browser window.
    window.pageXOffset
    An alias for window.scrollX.
    window.pageYOffset
    An alias for window.scrollY
    window.parent
    Returns a reference to the parent of the current window or subframe.
    window.performance
    Provides a hosting area for performance related attributes.
    window.personalbar
    Returns the personalbar object, whose visibility can be toggled in the window.
    window.pkcs11
    Formerly provided access to install and remove PKCS11 modules. Now this property is always null.
    window.returnValue
    The return value to be returned to the function that called window.showModalDialog() to display the window as a modal dialog.
    window.screen
    Returns a reference to the screen object associated with the window.
    window.screen.availTop
    Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features.
    window.screen.availLeft
    Returns the first available pixel available from the left side of the screen.
    window.screen.availHeight
    Specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows.
    window.screen.availWidth
    Returns the amount of horizontal space in pixels available to the window.
    window.screen.colorDepth
    Returns the color depth of the screen.
    window.screen.height
    Returns the height of the screen in pixels.
    window.screen.left
    Returns the current distance in pixels from the left side of the screen.
    window.screen.pixelDepth
    Gets the bit depth of the screen.
    window.screen.top
    Returns the distance from the top of the screen.
    window.screen.width
    Returns the width of the screen.
    window.screenX
    Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
    window.screenY
    Returns the vertical distance of the top border of the user's browser from the top side of the screen.
    window.scrollbars
    Returns the scrollbars object, whose visibility can be toggled in the window.
    window.scrollMaxX
    The maximum offset that the window can be scrolled to horizontally.
    (i.e., the document width minus the viewport width)
    window.scrollMaxY
    The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
    window.scrollX
    Returns the number of pixels that the document has already been scrolled horizontally.
    window.scrollY
    Returns the number of pixels that the document has already been scrolled vertically.
    window.self
    Returns an object reference to the window object itself.
    window.sessionStorage
    A storage object for storing data within a single page session.
    window.sidebar
    Returns a reference to the window object of the sidebar.
    window.status
    Gets/sets the text in the statusbar at the bottom of the browser.
    window.statusbar
    Returns the statusbar object, whose visibility can be toggled in the window.
    window.toolbar
    Returns the toolbar object, whose visibility can be toggled in the window.
    window.top
    Returns a reference to the topmost window in the window hierarchy. This property is read only.
    window.URL
    A DOM URL object, which provides the window.URL.createObjectURL() and window.URL.revokeObjectURL() methods.
    window.window
    Returns a reference to the current window.
    window[0], window[1], etc.
    Returns a reference to the window object in the frames. See window.frames for more details.

    メソッド

    window.addEventListener
    Register an event handler to a specific event type on the window.
    window.alert
    Displays an alert dialog.
    window.atob
    Decodes a string of data which has been encoded using base-64 encoding.
    window.back
    Moves back one in the window history.
    window.blur
    Sets focus away from the window.
    window.btoa
    Creates a base-64 encoded ASCII string from a string of binary data.
    window.captureEvents 廃止 Gecko 24
    Registers the window to capture all events of the specified type.
    window.clearImmediate
    Cancels the repeated execution set using setImmediate.
    window.clearInterval
    Cancels the repeated execution set using setInterval.
    window.clearTimeout
    Cancels the repeated execution set using setTimeout.
    window.close
    Closes the current window.
    window.confirm
    Displays a dialog with a message that the user needs to respond to.
    window.disableExternalCapture 廃止 Gecko 24
    FIXME: NeedsContents
    window.dispatchEvent
    FIXME: NeedsContents
    window.dump
    Writes a message to the console.
    window.enableExternalCapture 廃止 Gecko 24
    FIXME: NeedsContents
    window.escape
    Encodes a string.
    window.find
    Searches for a given string in a window.
    window.focus
    Sets focus on the current window.
    window.forward
    Moves the window one document forward in the history.
    window.GeckoActiveXObject
    FIXME: NeedsContents
    window.getAttention
    Flashes the application icon.
    window.getAttentionWithCycleCount
    FIXME: NeedsContents
    window.getComputedStyle
    Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
    window.getDefaulComputedStyle
    Gets default computed style for the specified element, ignoring author stylesheets.
    window.getSelection
    Returns the selection object representing the selected item(s).
    window.home
    Returns the browser to the home page.
    window.matchMedia
    Returns a MediaQueryList object representing the specified media query string.
    window.maximize
    FIXME: NeedsContents
    window.minimize (top-level XUL windows only)
    Minimizes the window.
    window.moveBy
    Moves the current window by a specified amount.
    window.moveTo
    Moves the window to the specified coordinates.
    window.mozRequestAnimationFrame
    Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame. This will cause a MozBeforePaint event to fire before that repaint occurs.
    window.open
    Opens a new window.
    window.openDialog
    Opens a new dialog window.
    window.postMessage
    Provides a secure means for one window to send a string of data to another window, which need not be within the same domain as the first, in a secure manner.
    window.print
    Opens the Print Dialog to print the current document.
    window.prompt
    Returns the text entered by the user in a prompt dialog.
    window.QueryInterface
    FIXME: NeedsContents
    window.releaseEvents 廃止 Gecko 24
    Releases the window from trapping events of a specific type.
    window.removeEventListener
    Removes an event listener from the window.
    window.resizeBy
    Resizes the current window by a certain amount.
    window.resizeTo
    Dynamically resizes window.
    window.restore
    FIXME: NeedsContents
    window.routeEvent 廃止 Gecko 24
    FIXME: NeedsContents
    window.scroll
    Scrolls the window to a particular place in the document.
    window.scrollBy
    Scrolls the document in the window by the given amount.
    window.scrollByLines
    Scrolls the document by the given number of lines.
    window.scrollByPages
    Scrolls the current document by the specified number of pages.
    window.scrollTo
    Scrolls to a particular set of coordinates in the document.
    window.setCursor
    Changes the cursor for the current window
    window.setImmediate
    Execute a function after the browser has finished other heavy tasks
    window.setInterval
    Execute a function each X milliseconds.
    window.setResizable
    FIXME: NeedsContents
    window.setTimeout
    Sets a delay for executing a function.
    window.showModalDialog
    Displays a modal dialog.
    window.sizeToContent
    Sizes the window according to its content.
    window.stop
    This method stops window loading.
    window.unescape
    Unencodes a value that has been encoded in hexadecimal (e.g. a cookie).
    window.updateCommands
    Updates the state of commands of the current chrome window (UI).
    window.XPCNativeWrapper
    FIXME: NeedsContents
    window.XPCSafeJSObjectWrapper

    Event handlers

    These are properties of the window object that can be set to establish event handlers for the various things that can happen in the window that might be of interest.

    Gecko 9.0 note
    (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6)

    Starting in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6), you can now use the syntax if ("onabort" in window) to determine whether or not a given event handler property exists. This is because event handler interfaces have been updated to be proper web IDL interfaces. See DOM event handlers for details.

    window.onabort
    An event handler property for abort events on the window.
    window.onbeforeunload
    An event handler property for before-unload events on the window.
    window.onblur
    An event handler property for blur events on the window.
    window.onchange
    An event handler property for change events on the window.
    window.onclick
    An event handler property for click events on the window.
    window.onclose
    An event handler property for handling the window close event.
    window.oncontextmenu
    An event handler property for right-click events on the window.
    window.ondevicelight
    An event handler property for any ambient light levels changes
    window.ondevicemotion
    FIXME: NeedsContents
    window.ondeviceorientation
    FIXME: NeedsContents
    window.ondeviceproximity
    An event handler property for device proximity event
    window.ondragdrop
    An event handler property for drag and drop events on the window.
    window.onerror
    An event handler property for errors raised on the window.
    window.onfocus
    An event handler property for focus events on the window.
    window.onhashchange
    An event handler property for hash change events on the window; called when the part of the URL after the hash mark ("#") changes.
    window.onkeydown
    An event handler property for keydown events on the window.
    window.onkeypress
    An event handler property for keypress events on the window.
    window.onkeyup
    An event handler property for keyup events on the window.
    window.onload
    An event handler property for window loading.
    window.onmousedown
    An event handler property for mousedown events on the window.
    window.onmousemove
    An event handler property for mousemove events on the window.
    window.onmouseout
    An event handler property for mouseout events on the window.
    window.onmouseover
    An event handler property for mouseover events on the window.
    window.onmouseup
    An event handler property for mouseup events on the window.
    window.onmozbeforepaint
    An event handler property for the MozBeforePaint event, which is sent before repainting the window if the event has been requested by a call to the window.mozRequestAnimationFrame() method.
    window.onpaint
    An event handler property for paint events on the window.
    window.onpopstate
    An event handler property for popstate events, which are fired when navigating to a session history entry representing a state object.
    window.onreset
    An event handler property for reset events on the window.
    window.onresize
    An event handler property for window resizing.
    window.onscroll
    An event handler property for window scrolling.
    window.onselect
    An event handler property for window selection.
    window.onsubmit
    An event handler property for submits on window forms.
    window.onunload
    An event handler property for unload events on the window.
    window.onuserproximity
    An event handler property for user proximity events
    window.onpageshow
    An event handler property for pageshow events on the window.
    window.onpagehide
    An event handler property for pagehide events on the window.

    コンストラクタ

    Image
    Used for creating an HTMLImageElement.
    Option
    Used for creating an HTMLOptionElement
    Worker
    Used for creating a Web worker

    関連情報

    ドキュメントのタグと貢献者

    Contributors to this page: Potappo, Crash, ethertank, Mgjbot, Okome, Shoot, Hfjapancom, Norah, khalid32
    最終更新者: khalid32,
    サイドバーを隠す