通过window.location方式来实现
window.location对象包括一下属性
- ancestorOrigins: DOMStringList {length: 0}
- assign: ƒ assign()
- hash: ""
- host: "developer.mozilla.org"
- hostname: "developer.mozilla.org"
- href: "https://developer.mozilla.org/zh-CN/docs/Web/API/Window/location"
- origin: "https://developer.mozilla.org"
- pathname: "/zh-CN/docs/Web/API/Window/location"
- port: ""
- protocol: "https:"
- reload: ƒ reload()
- replace: ƒ replace()
- search: ""
- toString: ƒ toString()
- valueOf: ƒ valueOf()
- Symbol(Symbol.toPrimitive): undefined
- [[Prototype]]: Location
我们通过 取端口(port),origin,protocol等来区分环境。常常不同环境不同的端口。以此来区分。