js get window custom global variables All In One
js get window custom global variables All In One
(function () {
// Grab browser's default global variables.
const iframe = window.document.createElement("iframe");
iframe.src = "about:blank";
window.document.body.appendChild(iframe);
const browserDefaultGlobals = Object.keys(iframe.contentWindow);
window.document.body.removeChild(iframe);
// Get the global variables added at runtime by filtering out the browser's
// default global variables from the current window object.
const runtimeGlobals = Object.keys(window).filter((key) => !browserDefaultGlobals.includes(key));
console.log("Runtime globals", runtimeGlobals);
})();
refs
https://gist.github.com/mmazzarolo/4cc6ab1b3f176874336bf1ceb7dff6ef#file-runtime-globals-checker-js
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/16204967.html
未经授权禁止转载,违者必究!