Skip to content

Instantly share code, notes, and snippets.

@wasdjkl
Created January 28, 2021 14:09
Show Gist options
  • Save wasdjkl/a3d0b650fb78e154e48b6f67b73b3716 to your computer and use it in GitHub Desktop.
Save wasdjkl/a3d0b650fb78e154e48b6f67b73b3716 to your computer and use it in GitHub Desktop.
对比当前页面 window 的特殊键名
(() => {
const iframe = document.createElement("iframe")
iframe.onload = () => {
const iframeKeys = Object.keys(iframe.contentWindow)
document.body.removeChild(iframe)
const windowKeys = Object.keys(window)
const keys = windowKeys.filter(key => {
return iframeKeys.indexOf(key) === -1
})
console.group("diff result:")
for (let key of keys) {
console.log(`${key} => `, window[key])
}
console.groupEnd()
console.log(keys)
}
document.body.appendChild(iframe)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment