2013-04-13

Bookmarklet to open a Youtube video in a new window

Sometimes I want to work in some other window while watching a Youtube video. This little bookmarklet opens a new window/tab with the particular Youtube video on the current page, without any fluff around the video.

To install it, just drag this link to your bookmarks toolbar, or copy the link and make a new bookmark and paste the link content there. Here is the actual link content:

javascript:var url=document.location.href;if(url.match('http.?://(www.)?youtube|youtu\.be')){yid=url.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0];window.open("http://www.youtube.com/v/" + yid + "&hl=en&fs=1");}else{alert("Could not find video ID")}

(you must include the "javascript:" part)

To use it, just click the bookmark when you have a Youtube page opened.

Enjoy!