Visit Mozilla.org

DOM:window

出典: MDC


« Gecko DOM リファレンス

◆◆◆ 翻訳中 ◆◆◆

このページは翻訳中です。
翻訳作業に参加する場合は、履歴にある翻訳者と連絡·調整してください。

このセクションは、DOM の window オブジェクト に用意されている メソッド、プロパティ、そして、イベントの全てについての簡潔なリファレンスを提供します。 window オブジェクトは Window インターフェースを実装し、Window インターフェースは AbstractView (日本語訳) インターフェースを継承しています。

window オブジェクトは、ウィンドウそれ自身を表します。 window オブジェクトの document プロパティは、そのウィンドウに読み込まれた DOM の document オブジェクト を指します。与えられたドキュメントに対するウィンドウは、document.defaultView プロパティを用いることで取得することができます。

Firefox のようなタブブラウザでは、タブの各々が、それ自身の window オブジェクトを持っています (拡張機能を記述している場合、ブラウザウィンドウそれ自身も別個のウィンドウです - 詳しい情報は、chrome コードでウィンドウを取り扱う を参照してください) 。つまり、window オブジェクトは、同じウィンドウのタブ間で共有されません。window.resizeTowindow.resizeBy のようないくつかのメソッドは、ウィンドウ全体に適用され、その window オブジェクトが属する特定のタブには適用されません。一般的に、タブに属することができないもっともな理由があるものは、代わりにウィンドウに属します。


[編集] プロパティ

window.applicationCache Firefox 3 の新機能
ウィンドウのオフラインリソースへのアクセスを提供する nsIDOMOfflineResourceList オブジェクト。
window.Components
多くの XPCOM 機能へのエントリポイントです。いくつかのプロパティ、例えば、classes などは、必要な特権が与えられたコードでのみ動作します。
window.content 及び window._content
現在のウィンドウでのコンテンツ要素への参照を返します。アンダースコア付きの変数は非推奨です。
window.closed
このプロパティは、現在のウィンドウが閉じているかどうかを示します。
window.controllers
現在の chrome ウィンドウの XUL controller オブジェクトを返します。
window.crypto
ブラウザの crypto オブジェクトを返します。
window.defaultStatus
与えられたウィンドウのステータスバーのテキストを取得/設定します。
window.dialogArguments Firefox 3 の新機能
window.showModalDialog() メソッドが呼び出されたときにウィンドウ(それがダイアログボックスである場合)に渡された引数を得ます。これは nsIArray インターフェースです。
window.directories
現在の chrome での ディレクトリツールバーへの参照を返します。
window.document
ウィンドウが含む文書への参照を返します。
window.frameElement
ウィンドウが埋め込まれた要素、または、ウィンドウが埋め込まれていない場合は、null を返します。
window.frames
現在のウィンドウでのサブフレームの配列を返します。
window.fullScreen Firefox 3 の新機能
このプロパティは、ウィンドウがフルスクリーン表示状態であるかどうかを返します。
window.globalStorage Firefox 2 の新機能
複数のページに渡るデータを保存するために用いられる複数のストレージオブジェクト。
window.history
history オブジェクトへの参照を返します。
window.innerHeight
水平スクロールバーを含む(表示されている場合)、ブラウザウィンドウのコンテンツ領域の高さを取得します。
window.innerWidth
垂直スクロールバーを含む(表示されている場合)、ブラウザウィンドウのコンテンツ領域の幅を取得します。
window.length
ウィンドウのフレームの数を返します。
window.location
window オブジェクトのロケーション、または、現在の URL を取得/設定します。
window.locationbar
ウィンドウ内で表示/非表示を切り替える(トグル)ことができる locationbar オブジェクトを返します。
window.menubar
ウィンドウ内で表示/非表示を切り替える(トグル)ことができる menubar オブジェクトを返します。
window.name
ウィンドウ名を取得/設定します。
window.navigator
navigator オブジェクトへの参照を返します。
window.opener
現在のウィンドウを開いたウィンドウへの参照を返します。
window.outerHeight
ブラウザウィンドウの外側の高さを取得します。
window.outerWidth
ブラウザウィンドウの外側の幅を取得します。
window.pageXOffset
window.scrollX のエイリアスです。
window.pageYOffset
window.scrollY のエイリアスです。
window.parent
現在のウィンドウ、または、サブフレームの親ウィンドウへの参照を返します。
window.personalbar
ウィンドウ内で表示/非表示を切り替える(トグル)ことができる、personalbar オブジェクトを返します。
window.pkcs11
pcks11 プロトコルに関連するドライバや他のソフトウェアをインストールするために用いられる pkcs11 オブジェクトを返します。
window.returnValue Firefox 3 の新機能
ウィンドウをモーダルダイアログとして表示する window.showModalDialog() メソッドを呼び出した関数へ返却される戻り値。
window.screen
ウィンドウに関連付けられた screen オブジェクトへの参照を返します。
window.screen.availTop
固定、あるいは、半固定されているユーザインターフェース部分は含まない、最初のピクセルの y 座標を示します。
window.screen.availLeft
画面の左端から利用できる最初の有効ピクセルを返します。
window.screen.availHeight
Windows でのタスクバーのような、オペレーティングシステムによって表示されている、固定、あるいは、半固定されているユーザインタフェース部分を引いた画面の高さをピクセル単位で示します。
window.screen.availWidth
ウィンドウで利用可能である水平空間の大きさをピクセル単位で返します。
window.screen.colorDepth
画面の色深度を返します。
window.screen.height
画面の高さをピクセル単位で返します。
window.screen.left
メイン画面の左端から現在の画面の左端までの距離をピクセル単位で返します。
window.screen.pixelDepth
画面のビット深度を取得します。
window.screen.top
現在の画面の上端からの距離をピクセル単位で返します。
window.screen.width
画面の幅を返します。
window.screenX
画面の左端からユーザのブラウザの左端までの水平距離を返します。
window.screenY
画面の上端からユーザのブラウザの上端までの垂直距離を返します。
window.scrollbars
ウィンドウ内で表示/非表示を切り替える(トグル)ことができる、scrollbars オブジェクトを返します。
window.scrollMaxX
ウィンドウが水平スクロールされ得る最大オフセット。
(即ち、ビューポートの幅を引いた文書の幅)
window.scrollMaxY
ウィンドウが垂直スクロールされ得る最大オフセット。
(即ち、ビューポートの高さを引いた文書の幅)
window.scrollX
文章が水平にスクロールされたピクセル数を返します。
window.scrollY
文書が垂直スクロールされたピクセル数を返します。
window.self
window オブジェクトそれ自身へのオブジェクトリファレンスを返します。
window.sessionStorage Firefox 3 の新機能
単一のページセッション内のデータを保存するためのストレージオブジェクト。
window.sidebar
サイドバーのウィンドウオブジェクトへの参照を返します。
window.status
ブラウザ下部のステータスバーのテキストを取得/設定します。
window.statusbar
ウィンドウ内で表示/非表示を切り替える(トグル)ことができる、statusbar オブジェクトを返します。
window.toolbar
ウィンドウ内で表示/非表示を切り替える(トグル)ことができる、toolbar オブジェクトを返します。
window.top
ウィンドウ階層における最上位のウィンドウへの参照を返します。
window.window
現在のウィンドウへの参照を返します。


[編集] Methods

window.alert
警告ダイアログを表示します。
window.addEventListener
Register an event handler to a specific event type on the window.
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 廃止
Registers the window to capture all events of the specified type.
window.clearInterval
setInterval で繰り返し実行されるよう設定された命令をキャンセルします。
window.clearTimeout
Clears a delay that's been set for a specific function.
window.close
Closes the current window.
window.confirm
Displays a dialog with a message that the user needs to respond to.
window.dump
コンソールにメッセージを出力します。
window.escape
文字列をエンコーディングします。
window.find
Searches for a given string in a window.
window.focus
現在のウィンドウにフォーカスを設定します。
window.forward
Moves the window one document forward in the history.
window.getAttention
Flashes the application icon.
window.getComputedStyle
Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
window.getSelection
Returns the selection object representing the selected item(s).
window.home
Returns the browser to the home page.
window.moveBy
Moves the current window by a specified amount.
window.moveTo
Moves the window to the specified coordinates.
window.open
新しいウィンドウを開きます。
window.openDialog
新しいダイアログウィンドウを開きます。
window.postMessage Firefox 3 の新機能
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.releaseEvents 廃止
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.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.setInterval
Execute a function each X milliseconds.
window.setTimeout
Sets a delay for executing a function.
window.showModalDialog Firefox 3 の新機能
モーダルダイアログを表示します。
window.sizeToContent
Sizes the window according to its content.
window.stop
このメソッドはウィンドウの読み込みを中止します。
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).


[編集] Event Handlers

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.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.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.onpaint
An event handler property for paint events on the window.
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.