Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

pop up youtube video

Posted on 2011-02-13
3
Medium Priority
?
303 Views
Last Modified: 2012-05-11
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?

Thanks,

HNM

0
Comment
Question by:HelpNearMe
  • 3
3 Comments
 
LVL 2

Expert Comment

by:myr1
ID: 34882805
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

0
 
LVL 2

Expert Comment

by:myr1
ID: 34882833
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")
0
 
LVL 2

Accepted Solution

by:
myr1 earned 2000 total points
ID: 34882862
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).
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question