Created
January 28, 2021 14:09
-
-
Save wasdjkl/a3d0b650fb78e154e48b6f67b73b3716 to your computer and use it in GitHub Desktop.
对比当前页面 window 的特殊键名
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
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