<html>
<body>
<!-- <iframe id="iff" srcdoc="<div>ok</div>"></iframe> -->
<iframe id="iff" src="data:text/html;charset=utf-8,%3Cdiv%3Eok%3C%2Fdiv%3E"></iframe>
<script>
console.log(document.getElementById('iff').contentWindow.document)
</script>
</body>
</html>
我在Get IFrame's document, from JavaScript in main document中看到我无法获得跨域iframe的文档,并且还从Which is the difference between srcdoc="..." and src="data:text/html,..." in an <iframe>?了解到iframeElement.contentDocument
和src
在跨域i行为上有所不同域行为。但是我都尝试了,都没有用。
2。当我将子项附加到iframe(设置了srcdoc
属性的 )的文档正文中时,DOM会更新,但不会显示在屏幕上。
答案 0 :(得分:0)
尝试类似的东西:
2019-03-16T06:17:44.493Z WARN :HLFConnection :_validatePeerResponses() Response from attempted peer comms was an error: Error: REQUEST_TIMEOUT {}$
2019-03-16T06:17:44.493Z ERROR :HLFConnection :start() {"message":"No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: REQUEST_TIMEOUT","stack":"Error: No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: REQUEST_TIMEOUT\n at HLFConnection._validatePeerResponses (/home/pavan/.nvm/versions/node/v8.15.1/lib/node_modules/composer-playground/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:855:19)\n at HLFConnection._sendTransaction (/home/pavan/.nvm/versions/node/v8.15.1/lib/node_modules/composer-playground/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:778:37)\n at HLFConnection.start (/home/pavan/.nvm/versions/node/v8.15.1/lib/node_modules/composer-playground/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:756:24)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:189:7)"}$
2019-03-16T06:17:44.494Z ERROR :ConnectorServer :connectionStart() {"message":"Error trying to start business network. Error: No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: REQUEST_TIMEOUT","stack":"Error: Error trying to start business network. Error: No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: REQUEST_TIMEOUT\n at HLFConnection.start (/home/pavan/.nvm/versions/node/v8.15.1/lib/node_modules/composer-playground/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:758:30)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:189:7)"}$
如果您使用网址查找iframe,这可能会很有用:
window.frames['iff'].document.myvar;