Edit in JSFiddle

// This initializes the viewer (called Stage).
var stage = new NGL.Stage('viewer');

// Now we load the 3D model of caffeine into the viewer. In this case we provide
// a URL pointing to the Chemical Identifier Resolver (https://cactus.nci.nih.gov/chemical/structure)
// If you want to load another molecule, just change 'caffeine' into something else.
stage.loadFile('https://cactus.nci.nih.gov/chemical/structure/caffeine/sdf', {
  // We also have to provide a file extension, in this case this is an SDF file.
  // SDF files are a type of chemical table file, more info: https://en.wikipedia.org/wiki/Chemical_table_file
  ext: 'sdf',
  
  // Initially the viewer does not have any molecular representation configured, so nothing is drawed.
  // With this setting we enable the default one.
  defaultRepresentation: true
});