简体   繁体   中英

Not interpret html in iframe but get the information from the html

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM