2
我有一個頁面,用戶可以在其中發佈Youtube視頻到論壇。將Youtube嵌入到Modal時訪問被拒絕錯誤
用戶帖子的鏈接到視頻的鏈接轉換爲這樣的事情後:
<a href='javascript:void(0)' class='video_player' data-videoid='http://www.youtube.com/embed/$vidID'>$video_title</a>
的$ vidID僅僅是你在每一個YouTube視頻的網址看到YouTube視頻ID。當用戶點擊鏈接播放視頻時,會打開一個模型,並在其中嵌入視頻。這裏是JS的模式:
$('.video_player').live('mouseover', function(event) {//VIDEO PLAYER MODAL
var videoid = $(this).attr("data-videoid");
var sourcepage = $(this).attr("data-sourcepage");
$(this).qtip({
id: 'videomodal',
content: {
text: '<img src="images/loading.gif" alt="Loading..." /> Loading..please wait.',
ajax: {url: 'modals/video_player.php',type: 'GET',data: { videoid: videoid, sourcepage: sourcepage}},
title: { text: 'Video Player', button: true }
},
position: { my: 'center', at: 'center', target: $(window) },
show: { event: 'click', solo: true, modal: true },
hide: false,
style: 'ui-tooltip-tipsy ui-tooltip-rounded higher-zindex',
events: {
hide: function(event, api){
auto_refresh = setInterval(function(){$('#bottom_middle').load(thisurl + '&timer=' + new Date().getTime() + ' #bottom_middle');}, 5000);
$(this).qtip("destroy");
}
},
});
return false;
});
這裏是我的video_Player.php代碼:(非常基本的,模態加載這個頁面,並嵌入所需的iframe來播放視頻)
<?PHP
$videoid = $_GET['videoid'];
$sourcepage = $_GET['sourcepage'];
echo "<iframe title='YouTube video player' width='480' height='390' src='$videoid' frameborder='0' allowfullscreen></iframe>";
?>
在鉻我得到「不安全的JavaScript嘗試訪問框架與URL等等等等」錯誤,但視頻播放和一切似乎正常工作,但在IE瀏覽器我得到SCRIPT5:訪問被拒絕。我已經搜索了網站,並在這個網站上尋找解決方案,但運氣不錯。任何人都知道爲這個或更好的方法工作?我使用模態(qtip2),這是唯一的要求。我所有的jquery庫都是最新的。