Is it possible to import css stylesheets into a html page using Javascript? If so, how can it be done?
P.S the javascript will be hosted on my site, but I want users to be able to put in the <head>
tag of their website, and it should be able to import a css file hosted on my server into the current web page. (both the css file and the javascript file will be hosted on my server).
Use this code:
Element.insertAdjacentHTML has very good browser support, and can add a stylesheet in one line.
I'm using thymeleaf and this is work fine. Thanks