How to copy all the css definitions under one iframe to one div?

I know my problem hurts because that"s what we need.
to put it simply, our requirement is to transfer all the content in an iframe (loading a web page) to a div as it is.

I have now made it possible to copy the contents of body from iframe, and the innerHTML, of div has been very successful.
is now stuck in the step of how to move the css definition over. I can get the styleSheet, of this iframe and see all kinds of cssRule, but I don"t know how to add it to the div.

I would like to ask the great gods, how to do this?

Mar.06,2021

I can't think of a perfect and simple solution for the time being. To make it simple, copy all the < link rel= "styleshee" > tags in iframe to < head > on the current page.

but I still think the problem is the demand itself. I suggest you discuss it with the product or technology again to see if it is really the only way to do it. The so-called unusual things must be demons, and the following of this strange demand is likely to be that the real needs are unknown and ill-considered.


since you can get the body, of iframe, is it okay to get all the link of iframe? just add link to head. Jquery should have a way to add it in this way

Menu