我尝试了以下方法:
.contents().find("#content")
.get(0).contentWindow.document
但他们都没有工作
(是的,我的iframe src在同一个域上)
编辑:
控制台正在记录此信息:
Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "null" from accessing a cross-origin frame.
at contents (jquery.min.js:2:26378)
at Function.map (jquery.min.js:2:3485)
at n.fn.init.n.fn.(anonymous function) [as contents] (jquery.min.js:2:26466)
at HTMLIFrameElement.<anonymous> (website.js:4:38)
at HTMLIFrameElement.dispatch (jquery.min.js:3:6466)
at HTMLIFrameElement.r.handle (jquery.min.js:3:3241)