Skip to content

Instantly share code, notes, and snippets.

@lifeinafolder
Created July 10, 2010 07:29
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 lifeinafolder/470542 to your computer and use it in GitHub Desktop.
Save lifeinafolder/470542 to your computer and use it in GitHub Desktop.
var img = new Image();
img.src = 'YOUR URL HERE';
img.onload = function(){
//do something when the image loads
// for instance, you may shove it in the DOM.
var imgDom = document.createElement('IMG');
imgDom.setAttribute('src','YOUR URL HERE');
//some dom element reference - element
element.appendChild(imgDom);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment