Not interpret html in iframe but get the informati

2019-09-04 14:38发布

In order to reduce the time of executing, we decide not to show the table in the iframe as the client cant see it. But we have to copy the contents of the table so as to update the table in the main page (which can be seen by the client).

The principle is that, the iframe shouldn't interpret html, but through a function written by JavaScript, we copy the updated table to the main page. We've thought about commenting the html out in the iframe, but it'll be very complicated as we could not get the element by Document.getElementById(Id). And we'll have to parser the html. Does anybody do similar things?

1条回答
劳资没心,怎么记你
2楼-- · 2019-09-04 14:55

Is the document you're requesting on the same domain as the "main page"? If so, you can request the second document via AJAX and use a regular expression to extract the element from it. This is all done without rendering any additional content to the DOM.

Once you have the table element extracted from the AJAX response, you can add it to the main page DOM.

查看更多
登录 后发表回答