非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

注意 : Since Firefox 57 (initially Nightly-only), both the content and _content variants are only available to chrome (privileged) code, and not available to the web anymore.

返回 Window object for the primary content window. This is useful in XUL windows that have a <browser> (或 tabbrowser or <iframe> ) with type="content-primary" attribute on it — the most famous example is Firefox main window, browser.xul 。在这种情况下, content returns a reference to the Window object for the document currently displayed in the browser. It is a shortcut for browserRef .contentWindow .

In unprivileged content (webpages), content is normally equivalent to top (except in the case of a webpage loaded in a sidebar, content still refers to the Window of the currently selected tab).

注意 : Some examples use _content 而不是 content . The former has been deprecated for a long time, and you should use content in any new code.

句法

var windowObject = window.content;
						

范例

Executing the following code in a chrome XUL window with a <browser type="content-primary"/> element in it draws a red border around the first div on the page currently displayed in the browser:

content.document.getElementsByTagName("div")[0].style.border = "solid red 1px";
						

规范

None.

另请参阅

元数据

  • 最后修改:
  1. Window
  2. 特性
    1. applicationCache
    2. caches
    3. closed
    4. console
    5. controllers
    6. crypto
    7. customElements
    8. defaultStatus
    9. devicePixelRatio
    10. dialogArguments
    11. 目录
    12. document
    13. frameElement
    14. frames
    15. fullScreen
    16. history
    17. indexedDB
    18. innerHeight
    19. innerWidth
    20. isSecureContext
    21. isSecureContext
    22. length
    23. localStorage
    24. location
    25. locationbar
    26. menubar
    27. mozAnimationStartTime
    28. mozInnerScreenX
    29. mozInnerScreenY
    30. mozPaintCount
    31. 名称
    32. navigator
    33. onabort
    34. onafterprint
    35. onanimationcancel
    36. onanimationend
    37. onanimationiteration
    38. onappinstalled
    39. onauxclick
    40. onbeforeinstallprompt
    41. onbeforeprint
    42. onbeforeunload
    43. onblur
    44. oncancel
    45. oncanplay
    46. oncanplaythrough
    47. onchange
    48. onclick
    49. onclose
    50. oncontextmenu
    51. oncuechange
    52. ondblclick
    53. ondevicelight
    54. ondevicemotion
    55. ondeviceorientation
    56. ondeviceorientationabsolute
    57. ondeviceproximity
    58. ondragdrop
    59. ondurationchange
    60. onended
    61. onerror
    62. onfocus
    63. ongamepadconnected
    64. ongamepaddisconnected
    65. ongotpointercapture
    66. onhashchange
    67. oninput
    68. oninvalid
    69. onkeydown
    70. onkeypress
    71. onkeyup
    72. onlanguagechange
    73. onload
    74. onloadeddata
    75. onloadedmetadata
    76. onloadend
    77. onloadstart
    78. onlostpointercapture
    79. onmessage
    80. onmessageerror
    81. onmousedown
    82. onmouseenter
    83. onmouseleave
    84. onmousemove
    85. onmouseout
    86. onmouseover
    87. onmouseup
    88. onmozbeforepaint
    89. onpaint
    90. onpause
    91. onplay
    92. onpointercancel
    93. onpointerdown
    94. onpointerenter
    95. onpointerleave
    96. onpointermove
    97. onpointerout
    98. onpointerover
    99. onpointerup
    100. onpopstate
    101. onrejectionhandled
    102. onreset
    103. onresize
    104. onscroll
    105. onselect
    106. onselectionchange
    107. onselectstart
    108. onstorage
    109. onsubmit
    110. ontouchcancel
    111. ontouchstart
    112. ontransitioncancel
    113. ontransitionend
    114. onunhandledrejection
    115. onunload
    116. onuserproximity
    117. onvrdisplayactivate
    118. onvrdisplayblur
    119. onvrdisplayconnect
    120. onvrdisplaydeactivate
    121. onvrdisplaydisconnect
    122. onvrdisplayfocus
    123. onvrdisplaypresentchange
    124. onwheel
    125. opener
    126. origin
    127. outerHeight
    128. outerWidth
    129. pageYOffset
    130. parent
    131. 性能
    132. personalbar
    133. pkcs11
    134. screen
    135. screenLeft
    136. screenTop
    137. screenX
    138. screenY
    139. scrollbars
    140. scrollMaxX
    141. scrollMaxY
    142. scrollX
    143. scrollY
    144. self
    145. sessionStorage
    146. sidebar
    147. speechSynthesis
    148. status
    149. statusbar
    150. toolbar
    151. top
    152. visualViewport
    153. window
    154. windowState
  3. 方法
    1. alert()
    2. atob()
    3. back()
    4. blur()
    5. btoa()
    6. cancelAnimationFrame()
    7. cancelIdleCallback()
    8. captureEvents()
    9. clearImmediate()
    10. clearInterval()
    11. clearTimeout()
    12. close()
    13. confirm()
    14. convertPointFromNodeToPage()
    15. convertPointFromPageToNode
    16. createImageBitmap()
    17. dump()
    18. event
    19. fetch()
    20. find()
    21. focus()
    22. forward()
    23. getAttention()
    24. getComputedStyle()
    25. getDefaultComputedStyle()
    26. getSelection()
    27. home()
    28. matchMedia()
    29. minimize()
    30. moveBy()
    31. moveTo()
    32. open()
    33. openDialog()
    34. postMessage()
    35. print()
    36. prompt()
    37. releaseEvents()
    38. requestAnimationFrame()
    39. requestFileSystem()
    40. requestIdleCallback()
    41. resizeBy()
    42. resizeTo()
    43. restore()
    44. routeEvent()
    45. scroll()
    46. scrollBy()
    47. scrollByLines()
    48. scrollByPages()
    49. scrollTo()
    50. setCursor()
    51. setImmediate()
    52. setInterval()
    53. setTimeout()
    54. showModalDialog()
    55. sizeToContent()
    56. stop()
    57. updateCommands()