function iframeReady(iframe, fn) {post
//iframe 若是 加載完成了.net
if (iframe.attachEvent) {iframe
iframe.attachEvent("onload", function () {string
fn && fn.call(iframe);io
});event
} else {function
//iframe 若是 加載未完成call
iframe.onload = function () {di
fn && fn.call(iframe);vi
};
}
}
調用:
$("#landPrePermissionFrame").attr("src", "http://"+CONSTANT.netServiceAddrIp+"/AppDemoLigerUI/FlowRedirectProxy.aspx");
var $myIframe = $('#landPrePermissionFrame');
iframeReady($myIframe[0],function psg(){
var $myIframe = $('#landPrePermissionFrame');
var params = {
eventType:"flowRedirect",
param:{
pageName:"用地預審收件"
}
};
$myIframe[0].contentWindow.postMessage(JSON.stringify(params),
"http://"+CONSTANT.netServiceAddrIp+"/AppDemoLigerUI/FlowRedirectProxy.aspx");
});