我有一個頁面上有一個iframe,我正在使用jQuery試圖添加一個額外的腳本到iframe和一個空的div在最後。插入一個div和腳本到一個頁面上的iframe
的iframe代碼:
<iframe class="kaltura" style="width: 608px; height: 402px;" title="EPI-522_Orav_Survival_Review_Part 1_Study Elements-H264 MP4 2Mbit 16x9 [22:17]" src="/courses/2873/external_tools/retrieve?borderless=1&url=https://hsphprod.kaf.kaltura.com/browseandembed/index/media/entryid/1_rs4bvlrn/showDescription/false/showTitle/false/showTags/false/showDuration/false/showOwner/false/showUploadDate/false/playerSize/608x402/playerSkin/30101351/" width="300" height="150" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" mozallowfullscreen="mozallowfullscreen"></iframe>
到目前爲止,腳本我有是:
jQuery(document).ready(function ($) {
// for each of the kaltura iframes
$('.kaltura').each(function (index) {
// find the body and add these items after
$(this).contents().find('body').append('<div id="threeplay-div"></div>');
// create the script element and insert it into the page
$(this).contents().find('#threeplay-div').append($("<script />", {
type: "text/javascript",
async: true,
src: "//static.3playmedia.com/p/projects/11439/files/831301/plugins/10616.js"
}));
});
});
,但運行時它不檢測I幀,也沒有追加股利或腳本到它。任何人有一個想法如何得到這個工作?
使用下面的代碼如何做到這一點的任何recomendation? – dpegasusm