title: How can I start a function in a new tab using a bookmarklet?
body: <p>This is my first time taking a shot at JavaScript, so excuse me if it seems a bit rough.</p>
  
  <p>This website <a href="http://www.keepvid.com/" rel="nofollow">http://www.keepvid.com/</a> provides a bookmark with JavaScript that allows you to download video off of YouTube and other media sites by clicking on it when on the media page. However, I found that instead of opening the download page in a new tab, it opens it in the current one, interrupting the media (probably to encourage you to buy their pro version).</p>
  
  <p>Seeing it as a chance to try out JavaScript (as I have only used bookmarklets before), I have been searching for answers, but the ones I found seem to only have worked with older versions of the website, as the JavaScript seems updated.</p>
  
  <p>I have been trying to make a bookmarklet that opens a new page, and then loads the download page for the media.</p>
  
  <p>The first code I encountered as a solution was: <code>javascript:void(window.open('http://keepvid.com/?url='+escape(window.location)));</code></p>
  
  <p>But this didn't work, which was when I noticed that the bookmarklet's final URL added <code>&amp;bm=y</code> to the end of the URL, so I edited it to:<br>
  <code>javascript:void(window.open('http://keepvid.com/?url='+escape(window.location)+'&amp;bm=y'));</code></p>
  
  <p>I then looked at the bookmarklet's original code::<br>
  <code>javascript:
  (a%20=%20(b%20=%20document).createElement('script')).src%20=%20'http://keepvid.com/js/bm.js',%20b.body.appendChild(a);void(0);</code></p>
  
  <p>and realized that it was calling on an external script (I believe) and that it would have to stay intact.</p>
  
  <p>And from their I have been trying various methods at getting this to work, and so far, this is what I have:
  <code>javascript:void(window.open(window.location));void((a%20=%20(b%20=%20document).createElement('script')).src%20=%20'http://keepvid.com/js/bm.js',%20b.body.appendChild(a));</code></p>
  
  <p>This script opens a new tab, but the new tab will only be a copy of the YouTube video, and the original tab will load the download page, which still interrupts the media, rendering my work useless, if slightly more convenient.</p>
  
  <p>I have been trying every way I can, but it seems like I can't have a second script in the same bookmarklet without it pointing to the original tab it was called in.</p>
  
  <p>So, I have been wondering what it is I need to do in order to:
  1. Create a new tab
  2. Have the new tab load the download page (instead of the original)
  3. Leave the original tab alone and use it only to capture the window.location</p>
  
  <p>If this is impossible to do, is their a way to have a bookmarklet in the toolbox that makes a copy of the original page and then points to a bookmarklet in the bookmarks menu that contains the redirect to the download page?</p>