Created
November 11, 2023 23:49
-
-
Save markbattistella/c7da06c134bfb937574323c8066a33df to your computer and use it in GitHub Desktop.
Open Youtube in new window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){ | |
if(window.location.host === 'www.youtube.com' && window.location.pathname === '/watch'){ | |
var videoId = window.location.search.split('v=')[1]; | |
var ampersandPosition = videoId.indexOf('&'); | |
if(ampersandPosition != -1) { | |
videoId = videoId.substring(0, ampersandPosition); | |
} | |
var embedUrl = 'https://www.youtube.com/embed/' + videoId; | |
window.open(embedUrl, 'youtube', 'width=1920,height=1080'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment