HTML:标记语言
CSS:样式语言
JavaScript:脚本语言
Web API:编程接口
所有 Web 技术
学习 Web 开发
发现我们的工具
更好地了解 MDN
Window 接口的只读属性 origin 返回全局作用域的 origin,序列化为字符串。
Window
origin
字符串。
从 window 作用域内部执行,以下代码片段会将文档的全局作用域的 origin 记录到控制台。
console.log(window.origin); // On this page returns 'https://mdn.org.cn'
如果 origin 不是 scheme/host/port 元组(例如,您尝试从本地运行,即通过 file:// URL),origin 将返回字符串 "null"。
file://
"null"
加载中…
WorkerGlobalScope.origin