Solved

pop up youtube video

Posted on 2011-02-13
3
266 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now