Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3137
  • 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 KimuraSEO, Web DeveloperAuthor 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
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
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 KimuraSEO, Web DeveloperAuthor 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

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