【发布时间】:2015-02-05 10:42:52
【问题描述】:
我有 MS CRM 2011(5.0.9690.2243,按需)HTML Web 资源,可在 IFRAME 中加载实体:
<HTML>
<HEAD>
<SCRIPT type=text/javascript src="http://code.jquery.com/jquery-latest.min.js"></SCRIPT>
<SCRIPT>
$(document).ready(function(){
if (window.console)
console.log('doc ready');
var f=$("#m4_ifr_entity");
f.bind('load', function() {
if (window.console)
console.log('iframe loaded');
// do some stuff here
});
});
</SCRIPT>
<META charset=utf-8>
</HEAD>
<BODY contentEditable=true>
<DIV style="WIDTH: 800px; FLOAT: left; HEIGHT: 600px">
<IFRAME id=m4_ifr_entity height="100%" src="/main.aspx?etn=account&pagetype=entityrecord" width="100%"></IFRAME>
</DIV>
</BODY>
</HTML>
当执行“预览”时,console.log() 都出现在控制台中。都很好。
但是,当我将此网络资源作为 “导航链接” 添加到实体中,然后转到实体并单击导航中的链接时,浏览器控制台中只出现第一个 console.log(),而f.bind('load'... 内部的其他 console.log() 不存在,所以我认为 IFRAME 加载事件根本不会被触发。 IFRAME 本身加载得很好。
当我将调试器附加到 javascript 时,我看到 f.bind('load', function() { 已到达,但调试器没有介入。
我在控制台中没有看到任何错误。我做了网络资源的“发布”。在 IE 9 和 IE 11 中尝试过。
问题是:为什么 jQuery f.bind('load'... 在第二个用例中没有执行?
【问题讨论】:
标签: jquery iframe dynamics-crm-2011 dynamics-crm onload