Skip to content

Instantly share code, notes, and snippets.

@alejandrolechuga
Created November 15, 2011 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejandrolechuga/1368481 to your computer and use it in GitHub Desktop.
Save alejandrolechuga/1368481 to your computer and use it in GitHub Desktop.
embed
/**
1.-Write a server script to read your file contents from a url
2.-Remove breaklines
3.-Place it on JS variable
4.-Output the html string as you want, document.write embeds
5.-Embed it using the script tag
<script type="text/javascript" src="myScript.php"></script>
*/
var htmlString ="<h1>Red Dot Avatar</h1>\n<br>\n<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IAAAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1JREFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jqch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0vr4MkhoXe0rZigAAAABJRU5ErkJggg==\" alt=\"red dot\">";
document.write(htmlString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment