text: user4491: I'm trying to use igv.js for a very simple visualization of some genomic alignments, but I can't get past the first step.  I have a FASTA file that I want to use as the reference, but igv.js consistently gives an error when I try to load that file.  The file is a valid FASTA (have tested others from other sources to be sure - same error), and I can specify a remote https:// file, but not a local file.
  Here's the HTML page I'm working on:
  <!DOCTYPE html>
  <html lang="en">
  
  <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  
      <title>Local FASTA Test</title>
  
      <!-- IGV JS-->
      <script src="https://igv.org/web/release/2.1.0/dist/igv.min.js"></script>
  
  </head>
  
  <body>
  
      <h1>Local File Test</h1>
  
      <div id="igv-div" style="padding-top: 10px;padding-bottom: 10px; border:1px solid lightgray"></div>
  
      <script type="text/javascript">
          var igvDiv = document.getElementById("igv-div");
          var options = {
              reference: {
                  fastaURL: "test.fasta"
              }
          };
  
          igv.createBrowser(igvDiv, options)
              .then(function(browser) {
                  console.log("Created IGV browser");
              })
      </script>
  
  </body>
  
  </html>
  
  and here's the FASTA file
  >HSBGPG Human gene for bone gla protein (BGP)
  GGCAGATTCCCCCTAGACCCGCCCGCACCATGGTCAGGCATGCCCCTCCTCATCGCTGGGCACAGCCCAGAGGGT
  ATAAACAGTGCTGGAGGCTGGCGGGGCAGGCCAGCTGAGTCCTGAGCAGCAGCCCAGCGCAGCCACCGAGACACC
  ATGAGAGCCCTCACACTCCTCGCCCTATTGGCCCTGGCCGCACTTTGCATCGCTGGCCAGGCAGGTGAGTGCCCC
  CACCTCCCCTCAGGCCGCATTGCAGTGGGGGCTGAGAGGAGGAAGCACCATGGCCCACCTCTTCTCACCCCTTTG
  GCTGGCAGTCCCTTTGCAGTCTAACCACCTTGTTGCAGGCTCAATCCATTTGCCCCAGCTCTGCCCTTGCAGAGG
  GAGAGGAGGGAAGAGCAAGCTGCCCGAGACGCAGGGGAAGGAGGATGAGGGCCCTGGGGATGAGCTGGGGTGAAC
  CAGGCTCCCTTTCCTTTGCAGGTGCGAAGCCCAGCGGTGCAGAGTCCAGCAAAGGTGCAGGTATGAGGATGGACC
  TGATGGGTTCCTGGACCCTCCCCTCTCACCCTGGTCCCTCAGTCTCATTCCCCCACTCCTGCCACCTCCTGTCTG
  GCCATCAGGAAGGCCAGCCTGCTCCCCACCTGATCCTCCCAAACCCAGAGCCACCTGATGCCTGCCCCTCTGCTC
  CACAGCCTTTGTGTCCAAGCAGGAGGGCAGCGAGGTAGTGAAGAGACCCAGGCGCTACCTGTATCAATGGCTGGG
  GTGAGAGAAAAGGCAGAGCTGGGCCAAGGCCCTGCCTCTCCGGGATGGTCTGTGGGGGAGCTGCAGCAGGGAGTG
  GCCTCTCTGGGTTGTGGTGGGGGTACAGGCAGCCTGCCCTGGTGGGCACCCTGGAGCCCCATGTGTAGGGAGAGG
  AGGGATGGGCATTTTGCACGGGGGCTGATGCCACCACGTCGGGTGTCTCAGAGCCCCAGTCCCCTACCCGGATCC
  CCTGGAGCCCAGGAGGGAGGTGTGTGAGCTCAATCCGGACTGTGACGAGTTGGCTGACCACATCGGCTTTCAGGA
  GGCCTATCGGCGCTTCTACGGCCCGGTCTAGGGTGTCGCTCTGCTGGCCTGGCCGGCAACCCCAGTTCTGCTCCT
  CTCCAGGCACCCTTCTTTCCTCTTCCCCTTGCCCTTGCCCTGACCTCCCAGCCCTATGGATGTGGGGTCCCCATC
  ATCCCAGCTGCTCCCAAATAAACTCCAGAAG
  
  
  user1681: just stumbled on this.  I'm the developer of igv.js.  Please feel free to open issues and questions on our git forum,  I don't often have time to browse other forums.
  Browsers will not allow loading of local files by file path in javascript, if they did it would be a gigantic security hole.  This restriction includes "file://" urls.  Local files can be loaded by user action (clicking a button),  that is supported in igv.js but there is no button for it as igv.js is designed as a component to embed in pages, not an application by itself.  For an example see igv.org/app (https://github.com/igvteam/igv-webapp),  a minimal application wrapping igv.js.  You'll find "local file" options for genomes and tracks there. 
  
  user3828: It looks as though the script is looking for a URL (fastaURL) so you could try specifying the file as file://directory/test.fasta
  By default though, javascript cannot read local files from disk for security reasons. Are you sure it is even possible to specify a local file in your script in this way?  If yes, then the problem is likely that you need to specify the path correctly.
  
original_text: 4491: <p>I'm trying to use igv.js for a very simple visualization of some genomic alignments, but I can't get past the first step.  I have a FASTA file that I want to use as the reference, but igv.js consistently gives an error when I try to load that file.  The file is a valid FASTA (have tested others from other sources to be sure - same error), and I can specify a remote https:// file, but not a local file.</p>
  
  <p>Here's the HTML page I'm working on:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"&gt;
  
      &lt;title&gt;Local FASTA Test&lt;/title&gt;
  
      &lt;!-- IGV JS--&gt;
      &lt;script src="https://igv.org/web/release/2.1.0/dist/igv.min.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;h1&gt;Local File Test&lt;/h1&gt;
  
      &lt;div id="igv-div" style="padding-top: 10px;padding-bottom: 10px; border:1px solid lightgray"&gt;&lt;/div&gt;
  
      &lt;script type="text/javascript"&gt;
          var igvDiv = document.getElementById("igv-div");
          var options = {
              reference: {
                  fastaURL: "test.fasta"
              }
          };
  
          igv.createBrowser(igvDiv, options)
              .then(function(browser) {
                  console.log("Created IGV browser");
              })
      &lt;/script&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>and here's the FASTA file</p>
  
  <pre><code>&gt;HSBGPG Human gene for bone gla protein (BGP)
  GGCAGATTCCCCCTAGACCCGCCCGCACCATGGTCAGGCATGCCCCTCCTCATCGCTGGGCACAGCCCAGAGGGT
  ATAAACAGTGCTGGAGGCTGGCGGGGCAGGCCAGCTGAGTCCTGAGCAGCAGCCCAGCGCAGCCACCGAGACACC
  ATGAGAGCCCTCACACTCCTCGCCCTATTGGCCCTGGCCGCACTTTGCATCGCTGGCCAGGCAGGTGAGTGCCCC
  CACCTCCCCTCAGGCCGCATTGCAGTGGGGGCTGAGAGGAGGAAGCACCATGGCCCACCTCTTCTCACCCCTTTG
  GCTGGCAGTCCCTTTGCAGTCTAACCACCTTGTTGCAGGCTCAATCCATTTGCCCCAGCTCTGCCCTTGCAGAGG
  GAGAGGAGGGAAGAGCAAGCTGCCCGAGACGCAGGGGAAGGAGGATGAGGGCCCTGGGGATGAGCTGGGGTGAAC
  CAGGCTCCCTTTCCTTTGCAGGTGCGAAGCCCAGCGGTGCAGAGTCCAGCAAAGGTGCAGGTATGAGGATGGACC
  TGATGGGTTCCTGGACCCTCCCCTCTCACCCTGGTCCCTCAGTCTCATTCCCCCACTCCTGCCACCTCCTGTCTG
  GCCATCAGGAAGGCCAGCCTGCTCCCCACCTGATCCTCCCAAACCCAGAGCCACCTGATGCCTGCCCCTCTGCTC
  CACAGCCTTTGTGTCCAAGCAGGAGGGCAGCGAGGTAGTGAAGAGACCCAGGCGCTACCTGTATCAATGGCTGGG
  GTGAGAGAAAAGGCAGAGCTGGGCCAAGGCCCTGCCTCTCCGGGATGGTCTGTGGGGGAGCTGCAGCAGGGAGTG
  GCCTCTCTGGGTTGTGGTGGGGGTACAGGCAGCCTGCCCTGGTGGGCACCCTGGAGCCCCATGTGTAGGGAGAGG
  AGGGATGGGCATTTTGCACGGGGGCTGATGCCACCACGTCGGGTGTCTCAGAGCCCCAGTCCCCTACCCGGATCC
  CCTGGAGCCCAGGAGGGAGGTGTGTGAGCTCAATCCGGACTGTGACGAGTTGGCTGACCACATCGGCTTTCAGGA
  GGCCTATCGGCGCTTCTACGGCCCGGTCTAGGGTGTCGCTCTGCTGGCCTGGCCGGCAACCCCAGTTCTGCTCCT
  CTCCAGGCACCCTTCTTTCCTCTTCCCCTTGCCCTTGCCCTGACCTCCCAGCCCTATGGATGTGGGGTCCCCATC
  ATCCCAGCTGCTCCCAAATAAACTCCAGAAG
  </code></pre>
   1681: <p>just stumbled on this.  I'm the developer of igv.js.  Please feel free to open issues and questions on our git forum,  I don't often have time to browse other forums.</p>
  
  <p>Browsers will not allow loading of local files by file path in javascript, if they did it would be a gigantic security hole.  This restriction includes "file://" urls.  Local files can be loaded by user action (clicking a button),  that is supported in igv.js but there is no button for it as igv.js is designed as a component to embed in pages, not an application by itself.  For an example see igv.org/app (<a href="https://github.com/igvteam/igv-webapp" rel="nofollow noreferrer">https://github.com/igvteam/igv-webapp</a>),  a minimal application wrapping igv.js.  You'll find "local file" options for genomes and tracks there. </p>
   3828: <p>It looks as though the script is looking for a URL (fastaURL) so you could try specifying the file as file://directory/test.fasta</p>
  
  <p>By default though, javascript cannot read local files from disk for security reasons. Are you sure it is even possible to specify a local file in your script in this way?  If yes, then the problem is likely that you need to specify the path correctly.</p>
  