I'm having a problem getting Chrome to return the contents of an iframe using jQuery contents()
. The following code works as expected in FireFox, but Chrome doesn't return any contents of the body. The iframe document is in the same domain as the main document and does indeed have some content. (I include the iframe twice in the document, distinguishing each using .eq(#)
selector which is why jQuery.fn.init[2]
shows 2 elements.) As I noted, this works in FireFox.
var $iframe_contents = $("iframe").contents();
excerpt from Chrome debugger.
$iframe_contents: jQuery.fn.init[2] (There are 2 iframes in the document)
0: document
URL: "about:blank"
activeElement: body
all: HTMLAllCollection[3]
...
baseURI: "about:blank"
...
**body: body**
...
baseURI: "about:blank"
...
**childElementCount: 0
childNodes: NodeList[0]
children: HTMLCollection[0]**
classList: DOMTokenList[0]
...
dataset: DOMStringMap
dir: ""
...
**firstChild: null
firstElementChild: null**
hidden: false
id: ""
**innerHTML: ""
innerText: ""**
...
**lastChild: null
lastElementChild: null**
link: ""
localName: "body"
.....
.....