javascript获取iframe框架中,加载的页面document对象 因为浏览器安全限制,对跨域访问的页面,其document对象无法读取.设置属性 function getDocument(iframe) { var Doc; try{ Doc = iframe.contentWindow.document;// For IE5.5 and IE6 }
使用谷歌浏览器调试代码时无意间发现了一个奇特的问题:从iframe页面调用父级页面的方法,window.parent.text(),出现 Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match., 这主要是没有获取iframe所在页面的parent的造成的 如果在本地用file协议使