Skip to content

Instantly share code, notes, and snippets.

@cdevroe
Last active February 15, 2023 02:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cdevroe/130cf067f799edfa63e5fe7e476b903b to your computer and use it in GitHub Desktop.
Save cdevroe/130cf067f799edfa63e5fe7e476b903b to your computer and use it in GitHub Desktop.
YouTube pop-up Bookmarklet

YouTube Pop-up Bookmarklet

I forget where I found this originally (sorry). And I've modified it slightly over the years. But if you're on YouTube in a desktop browser and you'd like to have the video in a small pop-up window, tap this bookmarklet and it automatically creates the perfectly sized window for you.

How to install

  1. Create a new bookmark with any URL.
  2. Edit that bookmark in your browser, delete the URL that is there, and paste the code you see in the JS file into the Location field.

You're welcome / Colin

javascript:ytplayer=document.getElementById('movie_player');ytplayer.pauseVideo();winsize=screen.width-650;vidparams=((document.location.search.includes('&'))%20?%20document.location.search.replace('?v=','').replace('&','?')%20+%20'&'%20:%20document.location.search.replace('?v=','')+'?');void(window.open('http://www.youtube.com/embed/'+vidparams+'vq=hd1080&autoplay=true&start='+Math.floor(ytplayer.getCurrentTime()),'_blank','height=333,width=592,top=50,left='+winsize))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment