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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2655
  • Last Modified:

Play youtube video in new window

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,
Victor
0
Victor Kimura
Asked:
Victor Kimura
  • 2
  • 2
  • 2
  • +1
3 Solutions
 
Kris MontgomeryCommented:
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.

Thanks!

mug
0
 
Victor KimuraAuthor Commented:
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?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Schells_Web_DesignCommented:
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 youtube.com website.

<a href="youtube.com 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 youtube.com 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="window.open('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.
0
 
Victor KimuraAuthor Commented:
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?
0
 
Schells_Web_DesignCommented:
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:   http://www.youtube.com/v/video1
The autoplay link is this:    http://www.youtube.com/v/video1&autoplay=1

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?
0
 
CodebotCommented:
use this
<object width="640" height="385"><param   name="movie" value="http://www.youtube.com/v/QDe6MZQjpho?fs=1&amp;hl=en_GB"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"autoplay="1"></param><embed src="http://www.youtube.com/v/QDe6MZQjpho?fs=1&amp;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

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now