Play youtube video in new window

Posted on 2010-11-17
Last Modified: 2012-05-10
How can I play a youtube in a new window from the embedded code of youtube? Is this possible so it will play once the user clicks on the youtube embedded tag?

Thank you,
Question by:Victor Kimura
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1

Expert Comment

by:Kris Montgomery
ID: 34153284
I think you are asking how to put the YouTube video on another site, correct?

That would just be copying the embed code and pasting it in the HTML code of your webpage.

The entire video will display on your page.



Author Comment

by:Victor Kimura
ID: 34154732
Thank you for the links and the suggestion. But what I'd like is to have users click on the youtube link so that a new window (I guess a javascript window) to open so the video will play automatically in the new window. I think I saw a thread regarding this using javascript but I couldn't find the code for it. Any ideas?
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.


Assisted Solution

Schells_Web_Design earned 333 total points
ID: 34156739
I'm not quite sure I understand all you are asking, but you can just use a simple target statement in a link if the link is from your website to the website.

<a href=" link" target="new">Link goes here</a>

Are you talking about taking the youtube video and putting it on YOUR site and then linking to that video from your own site?

If so, then I would just create a separate page with the video code on it and use the same link above, but it would just go to your own site instead the site.

Or you can javascript the size of the pop up if the new page just has the video on it:

<a href="javascript:void(0)"onclick="'video link','linkname','height=380, width=300,scrollbars=no')">Link goes here</a>

I don't think there's an easy way to embed the youtube code on your site and add a new window tag.  You would have to create a hidden <div> area to store the code and then create a javascript to call the <div> into a new pop-up window. Once that's done ... you will need a <a href> to call the script to open the window to play the hidden embed <div>.

Much easier to just to plop the code from youtube onto a page and open a new window to the dimentions of the video.

Hope that helps.

Author Comment

by:Victor Kimura
ID: 34157681
Hi Schells_Web_Design,

I think if the javascript code that you suggested is good but I'd like the youtube to play automatically once that javascript window opens. You mention to use <a href> to call the script to open the window to play the hidden embed. Is this referring to playing the youtube once it's opened?

Accepted Solution

Schells_Web_Design earned 333 total points
ID: 34157765
Playing automatically is something you would put into the embed tag.  Once you see the URL for the video, just add this code right behind it (no spaces):    &autoplay=1

So if the link is this:
The autoplay link is this:

As far as the javascript I mentioned at the end - it would open a web page you create with the embedded youtube on it. Just copy & paste the youtube code onto a page.

Does that help?

Assisted Solution

Codebot earned 167 total points
ID: 34164461
use this
<object width="640" height="385"><param   name="movie" value=";hl=en_GB"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"autoplay="1"></param><embed src=";hl=en_GB;autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" autoplay="1" width="640" height="385"></embed></object>

Open in new window


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to record live broadcast.

696 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