I know that it is possible to get a collection of attached stylesheets using document.styleSheets
. I also know it’s possible to work with individual rules within the style sheets.
Is it possible to read and write the entire text of a stylesheet? In particular, I want access to the stylesheets attached via the link
tag. I have found nothing through the search engines, and articles documenting stylesheets (such as the MDN article) don’t seem to mention it.
I want to use JavaScript to replace the some of content of the stylesheets on the fly, implementing a slightly dynamic stylesheet.
(I would prefer a solution without jQuery even if I have to do the cross browser work myself. Fortunately, IE8 is not an issue ).
Thanks