This is how this all works

  1. Upload this file to a php enabled site
  2. Make a bookmark in your browser that says
    javascript:void(location.href=i'http://example.com/page.php?u='+encodeURIComponent(location.href))
  3. Rename http://example.com/page.php to the actual page
  4. Give the bookmark a cool name
  5. Go to e.g. https://www.youtube.com/watch?v=WyriUZ_uDa4 and then click on the bookmark
  6. Enjoy
  7. Be angry that something does not work and change the code
  8. To see the code, go to code

This works with the following sites