Q:

Determine the existing properties in a iframe element

The following script:
function getIframe(id) {
   var iframe=null;
   for (var i = window.frames.length - 1; i >= 0; i--) {
      if(window.frames[i].frameElement.id==id){iframe=window.frames[i];break;}
   }
   return iframe;
}

console.log('iframe:',iframe);
console.log('keys',Object.keys(iframe));
console.log('iframe["width"]',iframe["width"]);

produces the following results:
iframe: Window ~.php?task=get_image&dummy=1435083899977
keys ["close", "stop", "focus", "blur", "open", "alert", "confirm", "prompt", "print", "showModalDialog", "postMessage", "captureEvents", "releaseEvents", "getSelection", "getComputedStyle", "matchMedia", "moveTo", "moveBy", "resizeTo", "resizeBy", "scroll", "scrollTo", "scrollBy", "requestAnimationFrame", "cancelAnimationFrame", "getDefaultComputedStyle", "mozRequestAnimationFrame", "mozCancelAnimationFrame", "mozCancelRequestAnimationFrame", "scrollByLines", "scrollByPages", "sizeToContent", "updateCommands", "find", "dump", "setResizable", "btoa", "atob", "setTimeout", "clearTimeout", "setInterval", "clearInterval", "self", "name", "history", "locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar", "status", "closed", "frames", "length", "opener", "parent", "frameElement", "navigator", "external", "applicationCache", "screen", "innerWidth", "innerHeight", "scrollX", "pageXOffset", "scrollY", "pageYOffset", "screenX", "screenY", "outerWidth", "outerHeight", "performance", "mozAnimationStartTime", "mozInnerScreenX", "mozInnerScreenY", "devicePixelRatio", "scrollMaxX", "scrollMaxY", "fullScreen", "mozPaintCount", "onwheel", "ondevicemotion", "ondeviceorientation", "ondeviceproximity", "onuserproximity", "ondevicelight", "content", "console", "sidebar", "crypto", "onabort", "onblur", "onfocus", "oncanplay", "oncanplaythrough", "onchange", "onclick", "oncontextmenu", "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "ondurationchange", "onemptied", "onended", "oninput", "oninvalid", "onkeydown", "onkeypress", "onkeyup", "onload", "onloadeddata", "onloadedmetadata", "onloadstart", "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onpause", "onplay", "onplaying", "onprogress", "onratechange", "onreset", "onresize", "onscroll", "onseeked", "onseeking", "onselect", "onshow", "onstalled", "onsubmit", "onsuspend", "ontimeupdate", "onvolumechange", "onwaiting", "onmozfullscreenchange", "onmozfullscreenerror", "onmozpointerlockchange", "onmozpointerlockerror", "indexedDB", "onerror", "onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onlanguagechange", "onmessage", "onoffline", "ononline", "onpagehide", "onpageshow", "onpopstate", "onunload", "localStorage", "sessionStorage", "window", "document", "location", "top", "$", "jQuery", "jQuery19107258252193071153", "obj", "virtualDirectory", "formatSizeUnits", "getThumb_folder", "getThumb_file", "getList_folder", "getList_file", "InstallTrigger"]
iframe["width"] <input id="width" class="input-small numbers-only" type="text" value="" title="Width" placeholder="Width">

As seen, "width" is not a key of iframe, and nor does Firebug show "width" when clicking Window ~.php?task=get_image&dummy=1435083124957 in firebug.
Without randomly trying different strings such as "width", how can I determine the existing properties in a iframe element?

A:

From Window.frames && iframe, these are different, what you get is an window.frame object, which just like a sub window, you can use innerWidth to get its viewport's width. And if you use something like 
document.getElementsByTagName("iframe")[0]; you'll get a <iFrame> which is a dom element, so you can use something like width to access its properties like other dom elements.
I'm not sure which object you purposed to get, but it seems that if want to alter the iframe's width, maybe you should use the dom one?
After some small tests, the iframe['width'] will have value, will have 2 possible case:

Some js code in current domain assign value to iframe['width']
The iframe src pages' js assign value to its window.width

However both method both would make Object.keys(iframe) to have the key width.
So, some may do this

Object.getPrototypeOf(iframe).width = .....; in current window, or 
Object.getPrototypeOf(window).width = .....; in iframe's src page.

I'm not sure why some will do this, but in that case, maybe you to access Object.getPrototypeOf(iframe) to get all possible keys.

