Skip to content

Instantly share code, notes, and snippets.

@andrexx
Created January 11, 2016 14:55
Show Gist options
  • Select an option

  • Save andrexx/56fac49446fae85fd108 to your computer and use it in GitHub Desktop.

Select an option

Save andrexx/56fac49446fae85fd108 to your computer and use it in GitHub Desktop.

Revisions

  1. andrexx created this gist Jan 11, 2016.
    17 changes: 17 additions & 0 deletions dump.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // http://stackoverflow.com/questions/17246309/get-all-user-defined-window-properties
    (function () {
    var results, currentWindow,
    // create an iframe and append to body to load a clean window object
    iframe = document.createElement('iframe');
    iframe.style.display = 'none';
    document.body.appendChild(iframe);
    // get the current list of properties on window
    currentWindow = Object.getOwnPropertyNames(window);
    // filter the list against the properties that exist in the clean window
    results = currentWindow.filter(function(prop) {
    return !iframe.contentWindow.hasOwnProperty(prop);
    });
    // log an array of properties that are different
    console.log(results);
    document.body.removeChild(iframe);
    }());