Jquery Iframe onload事件未在Google chrome上执行
Jquery Iframe onload event is not executing on Google chrome
我正在将内容从一帧复制到另一帧。我的代码在Mozilla Firefox中工作,但在Google Chrome中不工作。有人能告诉我哪里出了问题吗?
此部分未在Google chrome:中执行
$('#frame1').load(function(e){
});
下面是我的代码块:
$headContent = $("#mainframe").contents().find("head").html();
$bodyContent = $("#mainframe").contents().find("body").html();
$('<iframe />');
$('<iframe />',{ id: 'frame1',
class:'myframe',
height: 600,
width: "100%"
}).appendTo(uxcontainerPath);
$('#frame1').load(function(e){
console.log("Executed #frame1 load"); //this console line is not executed in chrome
$(this).contents().find('html').append('<head></head>');
$(this).contents().find('head').append($headContent);
$(this).contents().find('body').append($bodyContent);
});
如果加载事件触发得太快,请在将iframe注入DOM:之前添加加载侦听器
$('<iframe />',{ id: 'frame1',
class:'myframe',
height: 600,
width: "100%"
}).load(function(e){
console.log("Executed #frame1 load");
}).appendTo(uxcontainerPath);
相关文章:
- 通过命令行/批处理文件打开页面时,将javascript代码注入Google Chrome
- 如何在Google chrome安全首选项文件中创建扩展安全哈希代码
- Google Chrome扩展程序可以检测所有脚本何时加载完成吗
- JQuery BlockUI鼠标加载光标没有't在Google Chrome中返回默认值
- zClip没有在Google Chrome上复制值
- 在Google Chrome扩展中添加事件侦听器
- Google Chrome扩展在本地保存数据
- Google Chrome扩展跨域XMLHttpRequest
- 无法在google chrome扩展中使用jquery
- Applescript JavaScript“;行尾但找到标识符“;控制Google Chrome时出错
- 如何在AngularJS的上下文中使用Google Chrome Developer Tool在HTML代码中设置断点
- 仅打开调试器时出现Google chrome扩展错误
- Google Chrome 不会执行所有 JavaScript 语句
- 在 iFrame 中注入 JS 文件,通过 Google chrome 扩展名中的 ContentScript 进行
- Javascript not executing google chrome extensioin
- 如何调试遗留的javascript代码(适用于IE,但在Google Chrome中不正常)
- 如何从Google Chrome扩展中观察选项卡中的更改
- 可点击弹出条目Google Chrome扩展
- Javascript弹出式Google Chrome扩展
- 阻止Google Chrome更正格式错误的HTML脚本