pop up youtube video

Hi Experts,

I 'd like to add a youtube video to a website.  I don't want the video displayed in the page, instead I'd like it to pop up into a smaller window and begin playing when the user clicks the link on the page.

Anyone know where I can get a simple free solution for this or any ideas on how I would write the script to do it?



Who is Participating?
myr1Connect With a Mentor Commented:
Sorry for the first post. There is a bug, which causes opening of the link in both windows. Try this:
<a href="http://www.youtube.com/v/OuSdU8tbcHY&autoplay=1" onclick="return(!window.open(this.href,'windowname','location=0,status=0,width=800,height=600'))" target="_blank">Open YouTube</a>

Open in new window

This should work even with JavaScript turned off (without setting the size of the window).
You can use this code to open it in a new window:
<a href="http://youtube.com" onclick="!window.open(this.href,'windowname','location=0,status=0,width=800,height=600')">Open YouTube</a>

Open in new window

If you want to autoplay it, then add "&autoplay=1" at the end of the link.
(for example "http://www.youtube.com/v/OuSdU8tbcHY&autoplay=1")
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.