我需要的:
- 当用户点击视频网址时,它必须重定向到您的视频。
- 我们正在使用 html5lightbox 插件。
我面临的问题:
- 重定向在 iframe 中不起作用。
- 虽然当我点击 iframe 的 src 时,它会被重定向到 youtube url。
这是html代码
<div id="html5lightbox-web" style="display:block;width:500px;height:400px;">
<iframe width="500" height="400" src="http://t.co/hNLWmspb" frameborder="0">
</iframe></div>
- 我已经在 Chrome 上进行了测试,它不会自动重定向到特定页面网址。
问题解释
推文数据
VW @ European Motor Show Brussels - Behind the scene (part 1): <a class="twtlnk" rel="nofollow" href="http://youtu.be/XzqagJTsNrc" target=\"_blank\">http://youtu.be/XzqagJTsNrc</a> via <a class="twthand" href="https://twitter.com/youtube" rel="nofollow" target=\"_blank\" >@youtube</a>
这是代码片段
$media_url;// http://t.co/hNLWmspb
$parsed = parse_url($media_url);
print_r($parsed);
Array ( [scheme] => http [host] => t.co [path] => /hNLWmspb
$ytarray=explode("/", $media_url);
$ytendstring=end($ytarray);
$ytendarray=explode("?v=", $ytendstring);
$ytendstring=end($ytendarray);
$ytendarray=explode("&", $ytendstring);
$ytcode=$ytendarray[0];
print_r($ytcode);
if(preg_match('/http:\/\/(www\.)*youtube\.com\/.*/',$parsed['path']))
{
// echo "YouTube URL found!\n";
$content='<div class="4u"><div class="box photo tile">
<a href='.$media_url.' class="html5lightbox" data-group=""
titl="'.$tweet_content.'">';
}
else
{
$content='<div class="4u"><div class="box photo tile">
<a href="http://www.youtube.com/embed/""'.$ytcode.' class="html5lightbox" data-group=""
titl="'.$tweet_content.'">';
}
- 我得到了帮助如何在 PHP 中嵌入 YouTube 视频? https://stackoverflow.com/questions/412467/how-to-embed-youtube-videos-in-php.
URL 的服务器http://t.co/hNLWmspb
重定向到返回
x-frame-options:SAMEORIGIN
在您尝试在框架中显示的文档的 HTTP 响应标头中。
这会禁止其他网站(包括您的网站)在框架中显示该页面,因此浏览器不会呈现该页面。
请改用官方 YouTube 嵌入代码。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)