Solved

pop up youtube video

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

705 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

18 Experts available now in Live!

Get 1:1 Help Now