title: Reading src of an iframe from a text file
body: <p>I am trying to read a text file locally, which has a url for eg.www.google.com and pass this string as a src to an iframe. But the problem is that the src got appended with this:</p>
  
  <pre><code>//localhost/myfolder/%25/www/google.com
  </code></pre>
  
  <p>where <code>localhost/myfolder</code> is the path of the file in which I am using the iframe.</p>
  
  <p>Thanks in advance if anybody can help me out.</p>
  
  <pre><code>function read() 
     {
     var txtFile = new XMLHttpRequest();
     txtFile.open("GET", "http://localhost/myfolder/Text.txt",true);
     txtFile.onreadystatechange = function () 
     {
     if (txtFile.readyState === 4)
  {  
     // Makes sure the document is ready to parse.
     if (txtFile.status === 200)
  {  
     var alltext=txtFile.responseText;
     var linetext=txtFile.responseText.split("\n");
  var delimeter = '^';
  var text0= linetext[0];
  var splitted = text0.split(delimeter);
  $('#iframe1').attr('src', splitted[1]);
     }
     }
     }
     txtFile.send(null)
  
     }
  </code></pre>
  
  <p>i am using this code to read the file.</p>