window.onload = function() {
  add_link('http://findalong.com/session/323','First link added from js (hosted on remote server) dynamically ','div3');
  add_link('http://findalong.com/session/118','second such link ', 'div3');

  add_links_in_no_script(['http://findalong.com/session/123','http://findalong.com/session/390']);
};

function add_link(url,text,div_name) {
  var div = document.getElementById(div_name);
  var new_link = document.createElement('a');
  new_link.setAttribute('href',url);

  var text_node = document.createTextNode(text);
  new_link.appendChild(text_node);
  div.appendChild(new_link);
  div.appendChild(document.createElement('br'));
}

function add_links_in_no_script (links)
{

  
  var noscript = document.createElement('noscript');
  
  for (i=0; i< links.length; i++){
      var new_link = document.createElement('a');
      new_link.setAttribute('href',links[i]);
      var text_node = document.createTextNode("link " + i);
      new_link.appendChild(text_node);
      
      noscript.appendChild(new_link);
      noscript.appendChild(document.createElement('br'));
  }

}