title: Open local html file in current window with Javascript Bookmarklet
body: <p>I'm trying to build a sample bookmarklet to grab current webpage source code and pass it to a validator. Validator is not a an online website, but a folder with bunch of javascript and html files. I'm trying to open file:///C:/Users/Electrifyings/Desktop/Validator/Main.html file with the help of javascript bookmarklet code and put the source code in the textarea in the newly opened window, but it is not working for some reasons that I'm not aware of.</p>
  
  <p>Here is the sample code with algorithm:</p>
  
  <pre><code>javascript:(function(){var t = document.body.innerHTML;window.open('file:///C:/Users/RandomHero/Desktop/test.html',_self);document.getElementById("validator_textarea")=t;})()
  </code></pre>
  
  <p>Here are the steps:</p>
  
  <ol>
  <li>Grab current web page source code in a variable.</li>
  <li>Open locally stored HTML web page in current or new window or new tab (either way is fine with me, but no luck)</li>
  <li>Put the source code from the variable into the validator textarea of the newly opened HTML file.</li>
  </ol>
  
  <p>I have tried above code with a lot of variations, but got stuck on the part where it opens the new window. Either it's not opening the new window at all or it is opening blank window without loading the file.</p>
  
  <p>Would love to get some help with this issue, thanks a lot. </p>
  
  <p>Oh and btw,</p>
  
  <p>Windows 7 x64, Tried IE, Firefox and Chrome. All latest and stable builds. I guess it's not a browser side issues, but something related to javascript code not opening the URI with file:/// protocol. Let me know if any more details are needed. :)</p>