0

My current code extracts the video ID of a YouTube video and embeds it on its own page:

document.location = 'http://www.youtube.com/embed/' + document.location.href.match(/[&?]v=([^&#]*)/i)[1]

I want to add code that adds the three YouTube parameters "?modestbranding=1&rel=0&autoplay=1" after the video ID so it becomes:

http://www.youtube.com/embed/[VIDEOID]?modestbranding=1&rel=0&autoplay=1

How can this be done?

1 Answers1

1

Just needs to be added to the rest of your document.location assignment:

document.location = 'http://www.youtube.com/embed/' + document.location.href.match(/[&?]v=([^&#]*)/i)[1] + "?modestbranding=1&rel=0&autoplay=1"
Jessica
  • 36
  • 3