HTML:尝试嵌入YouTube视频 [英] HTML: trying to embed youtube video

查看:68
本文介绍了HTML:尝试嵌入YouTube视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将Youtube视频嵌入到我的网站时,发生以下错误:

发生错误.请稍后再试.(播放ID:044VSn6cAs2PR3y3)

我的 index.html 包含以下标记代码段:

 < div class ="mu-about-us-right">< a id ="mu-abtus-video" href ="https://www.youtube.com/embed/watch?v=lWz-46NPqdk" target ="youtube-video">< img src ="assets/img/about-us.jpg" alt ="img"></a></div> 

我无法理解代码中的错误.我还尝试了其他一些视频,所以这不是Youtube服务器的问题.

PS:我正在本地主机上运行我的网站

解决方案

尝试像这样使用iframe嵌入视频:

 < div class ="mu-about-us-right">< iframe width ="560" height ="315" src ="https://www.youtube.com/embed/lWz-46NPqdk" frameborder ="0" allowfullscreen></iframe></div> 

您不能使用定位标记来嵌入视频.

When I'm embedding a Youtube video into my website, the following error occurs:

An error occurred. Please try again later. (Playback ID: 044VSn6cAs2PR3y3) Learn More

My index.html contains the following markup snippet:

<div class="mu-about-us-right">
    <a id="mu-abtus-video" href="https://www.youtube.com/embed/watch?v=lWz-46NPqdk" target="youtube-video">
        <img src="assets/img/about-us.jpg" alt="img">
    </a>
</div>

I can't understand what is the error in my code. I have tried with some other videos as well so it's not a fault of Youtube server.

PS: I'm running my website on localhost

解决方案

Try embedding the video using an iframe like so:

<div class="mu-about-us-right">
   <iframe width="560" height="315" src="https://www.youtube.com/embed/lWz-46NPqdk" frameborder="0" allowfullscreen></iframe>
</div>

You can't use an anchor tag to embed videos.

这篇关于HTML:尝试嵌入YouTube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆