3
我有3个嵌套iframe,我想要访问第三个iframe中的元素(链接)。从其他iframe字符串获取iframe元素
var iframe = document.getElementById('aswift_2');
var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
var secondIframe = innerDoc.getElementById('google_ads_frame3');
var secondinnerDoc = secondIframe.contentDocument || secondIframe.contentWindow.document;
var treedIframe = document.getElementById('ad_iframe');
var secondinnerDoc = treedIframe.contentDocument || treedIframe.contentWindow.document;
var Link = secondinnerDoc.getElementById('aw0');
但是我在尝试访问时出错。
Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://localhost:63342" from accessing a cross-origin frame.
我怎样才能访问<a>
标签?