我有一个页面上有一个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