Home › Forums › JavaScript › Can you put CSS style inside of a JavaScript src? › Reply To: Can you put CSS style inside of a JavaScript src?
August 29, 2014 at 8:30 am
#181058
Participant
In there a way to “include”/”inject” an additional plain old inline style sheet “cross domain”?
link
it. If you really don’t want the user to do it (and I don’t see why not; it’s not that complicated), do it via javascript.
var l = document.createElement('link');
l.setAttribute('href','http://example.com/stylesheet.css');
l.setAttribute('rel', 'stylesheet');
l.setAttribute('type','text/css');
document.head.appendChild(l);
However, Paulie is right: this seems much more “sneaky” and untrustworthy than just instructing the user to add it to their page themselves.