Skip to content

Instantly share code, notes, and snippets.

@l-portet
Created May 17, 2021 22:17
Show Gist options
  • Save l-portet/72a1d39fcb86a7fcd2054e5db6d06e79 to your computer and use it in GitHub Desktop.
Save l-portet/72a1d39fcb86a7fcd2054e5db6d06e79 to your computer and use it in GitHub Desktop.
Find all the custom properties created in the window object. Very useful to debug or reverse engineer a web app.
(() => {
let results;
let currentWindow;
let customizedWindow = {};
let iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
currentWindow = Object.getOwnPropertyNames(window);
results = currentWindow.filter(function (prop) {
return !iframe.contentWindow.hasOwnProperty(prop);
});
for (const result of results) {
customizedWindow[result] = window[result];
}
console.log(results);
window.customizedWindow = customizedWindow;
console.log(customizedWindow);
document.body.removeChild(iframe);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment