• Skip to main content
  • Skip to search
  • Skip to select language
MDN Web Docs
  • References
    • Overview / Web Technology

      Web technology reference for developers

    • HTML

      Structure of content on the web

    • CSS

      Code used to describe document style

    • JavaScript

      General-purpose scripting language

    • HTTP

      Protocol for transmitting web resources

    • Web APIs

      Interfaces for building web applications

    • Web Extensions

      Developing extensions for web browsers

    • Accessibility

      Build web projects usable for all

    • Web Technology

      Web technology reference for developers

  • Learn
    • Overview / MDN Learning Area

      Learn web development

    • MDN Learning Area

      Learn web development

    • HTML

      Learn to structure web content with HTML

    • CSS

      Learn to style content using CSS

    • JavaScript

      Learn to run scripts in the browser

    • Accessibility

      Learn to make the web accessible to all

  • Plus
    • Overview

      A customized MDN experience

    • AI Help

      Get real-time assistance and support

    • Updates

      All browser compatibility updates at a glance

    • Documentation

      Learn how to use MDN Plus

    • FAQ

      Frequently asked questions about MDN Plus

  • Curriculum New
  • Blog
    • Playground

      Write, test and share your code

    • HTTP Observatory

      Scan a website for free

    • AI Help

      Get real-time assistance and support

  • Log in
  • Sign up for free
  1. 給開發者的 Web 技術文件
  2. Web APIs
  3. Document
  4. Document.defaultView
    • English (US)
    • Deutsch
    • Español
    • Français
    • 日本語
    • 한국어
    • Português (do Brasil)
    • Русский
    • 中文 (简体)

此頁面由社群從英文翻譯而來。了解更多並加入 MDN Web Docs 社群。

在本文中

  • 語法
  • 規範
  • 瀏覽器相容性
  1. Document
  2. 建構子
    1. Document()
  3. 實體屬性
    1. activeElement
    2. adoptedStyleSheets
    3. alinkColor 已棄用
    4. all 已棄用
    5. anchors 已棄用
    6. applets 已棄用
    7. bgColor 已棄用
    8. body
    9. characterSet
    10. childElementCount
    11. children
    12. compatMode
    13. contentType
    14. cookie
    15. currentScript
    16. defaultView
    17. designMode
    18. dir
    19. doctype
    20. documentElement
    21. documentURI
    22. domain 已棄用
    23. embeds
    24. featurePolicy 實驗性質
    25. fgColor 已棄用
    26. firstElementChild
    27. fonts
    28. forms
    29. fragmentDirective
    30. fullscreen 已棄用
    31. fullscreenElement
    32. fullscreenEnabled
    33. head
    34. hidden
    35. images
    36. implementation
    37. lastElementChild
    38. lastModified
    39. lastStyleSheetSet Non-standard 已棄用
    40. linkColor 已棄用
    41. links
    42. location
    43. pictureInPictureElement
    44. pictureInPictureEnabled
    45. plugins
    46. pointerLockElement
    47. preferredStyleSheetSet Non-standard 已棄用
    48. prerendering 實驗性質
    49. readyState
    50. referrer
    51. rootElement 已棄用
    52. scripts
    53. scrollingElement
    54. selectedStyleSheetSet Non-standard 已棄用
    55. styleSheets
    56. styleSheetSets Non-standard 已棄用
    57. timeline
    58. title
    59. URL
    60. visibilityState
    61. vlinkColor 已棄用
    62. xmlEncoding 已棄用
    63. xmlVersion 已棄用
  4. 靜態方法
    1. parseHTMLUnsafe()
  5. 實體方法
    1. adoptNode()
    2. append()
    3. browsingTopics() 實驗性質 Non-standard
    4. caretPositionFromPoint()
    5. caretRangeFromPoint() Non-standard
    6. clear() 已棄用
    7. close()
    8. createAttribute()
    9. createAttributeNS()
    10. createCDATASection()
    11. createComment()
    12. createDocumentFragment()
    13. createElement()
    14. createElementNS()
    15. createEvent() 已棄用
    16. createExpression()
    17. createNodeIterator()
    18. createNSResolver() 已棄用
    19. createProcessingInstruction()
    20. createRange()
    21. createTextNode()
    22. createTouch() Non-standard 已棄用
    23. createTouchList() Non-standard 已棄用
    24. createTreeWalker()
    25. elementFromPoint()
    26. elementsFromPoint()
    27. enableStyleSheetsForSet() Non-standard 已棄用
    28. evaluate()
    29. execCommand() 已棄用
    30. exitFullscreen()
    31. exitPictureInPicture()
    32. exitPointerLock()
    33. getAnimations()
    34. getElementById()
    35. getElementsByClassName()
    36. getElementsByName()
    37. getElementsByTagName()
    38. getElementsByTagNameNS()
    39. getSelection()
    40. hasFocus()
    41. hasStorageAccess()
    42. hasUnpartitionedCookieAccess()
    43. importNode()
    44. moveBefore()
    45. mozSetImageElement() Non-standard
    46. open()
    47. prepend()
    48. queryCommandEnabled() Non-standard 已棄用
    49. queryCommandState() Non-standard 已棄用
    50. queryCommandSupported() Non-standard 已棄用
    51. querySelector()
    52. querySelectorAll()
    53. releaseCapture() Non-standard
    54. replaceChildren()
    55. requestStorageAccess()
    56. requestStorageAccessFor() 實驗性質
    57. startViewTransition()
    58. write() 已棄用
    59. writeln()
  6. 事件
    1. afterscriptexecute Non-standard 已棄用
    2. beforescriptexecute Non-standard 已棄用
    3. copy
    4. cut
    5. DOMContentLoaded
    6. fullscreenchange
    7. fullscreenerror
    8. paste
    9. pointerlockchange
    10. pointerlockerror
    11. prerenderingchange 實驗性質
    12. readystatechange
    13. scroll
    14. scrollend
    15. scrollsnapchange 實驗性質
    16. scrollsnapchanging 實驗性質
    17. securitypolicyviolation
    18. selectionchange
    19. visibilitychange
  7. 繼承
    1. Node
    2. EventTarget

在本文中

  • 語法
  • 規範
  • 瀏覽器相容性

Document.defaultView

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

  • Learn more
  • See full compatibility
  • Report feedback

在瀏覽器中,document.defaultView 屬性會指向一個目前 document 所屬的 window 物件,若無則為 null。

語法

var win = document.defaultView;

此為唯讀屬性。

規範

Specification
HTML
# dom-document-defaultview-dev

瀏覽器相容性

Help improve MDN

Learn how to contribute.

This page was last modified on 2022年9月24日 by MDN contributors.

View this page on GitHub • Report a problem with this content
MDN logo

Your blueprint for a better internet.

  • MDN on Bluesky
  • MDN on Mastodon
  • MDN on X (formerly Twitter)
  • MDN on GitHub
  • MDN Blog RSS Feed

MDN

  • About
  • Blog
  • Careers
  • Advertise with us

Support

  • Product help
  • Report an issue

Our communities

  • MDN Community
  • MDN Forum
  • MDN Chat

Developers

  • Web Technologies
  • Learn Web Development
  • MDN Plus
  • Hacks Blog
  • Website Privacy Notice
  • Cookies
  • Legal
  • Community Participation Guidelines

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2025 by individual mozilla.org contributors. Content available under a Creative Commons license.

OSZAR »