Skip to content

Instantly share code, notes, and snippets.

@PaulKinlan
Created March 8, 2011 01:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save PaulKinlan/859643 to your computer and use it in GitHub Desktop.
Save PaulKinlan/859643 to your computer and use it in GitHub Desktop.
Add dataURI styleshhet
var toDataURI = function(datatype, data) {
return "data:" + datatype +";base64," + window.btoa(data);
};
var renderStyleSheet = function() {
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = toDataUri("text/css", "body { background-color: red;}" );
document.head.appendChild(link);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment