简体   繁体   中英

importing html file (and all the stylesheets and scripts) with javascript?

is there any way to import an external html file, with all the linked css and javascript files, to an already existing html document?

I have tried with JQuery method load() , but it seems it is ignoring scripts completely.

Basically, what I am trying to do is to load a complete component, with its style and logic/behavior.

I need to do this on the client side, with javascript.

This sounds like something you might be able to use an iframe for. An iframe will load an entirely different document inside a dom element.

<iframe src=""></iframe>

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