IE8的jquery插件加载事件问题
一旦这行代码在IE8$(this.frame)中完成执行,就可以取消绑定('load').load(function())->IE8中的状态栏显示出于某种原因的加载,并且加载持续了很长时间,并且尝试使用IE web developer进行调试也没有从中受益。我是否需要注意jquery+iframe和IE8中存在任何已知问题,并且是导致此问题的原因IE8的jquery插件加载事件问题,jquery,Jquery,一旦这行代码在IE8$(this.frame)中完成执行,就可以取消绑定('load').load(function())->IE8中的状态栏显示出于某种原因的加载,并且加载持续了很长时间,并且尝试使用IE web developer进行调试也没有从中受益。我是否需要注意jquery+iframe和IE8中存在任何已知问题,并且是导致此问题的原因 buildForm: function(fList, fOpts) { if (!(this.getLoca
buildForm: function(fList, fOpts) {
if (!(this.getLocalURL())) return false;
var iDoc = (this.frame.contentWindow) ? this.frame.contentWindow.document : (this.frame.contentDocument.document) ? this.frame.contentDocument.document : this.frame.contentDocument;
var newForm = iDoc.createElement('form');
var method = 'POST';
var postUrl = fOpts.serviceURL+'&callbackUrl='+this.startURL;
newForm.setAttribute('action',postUrl);
newForm.setAttribute('method', method);
$(newForm).append("<input name='userDetail' type='hidden' value='"+JSON.stringify(fList)+"' />");
$(newForm).append('<input name="callbackUrl" type="hidden" value="'+this.startURL+'" />');
newForm = iDoc.body.appendChild(newForm);
this.isWaiting = true;
$(this.frame).unbind('load').load(function(){
Port.formControl.call(Port, this, fOpts);
});
newForm.submit();
},
formControl: function(formEl, fOpts) {
var url;
if (!(url = this.getLocalURL())) return false;
if (this.isWaiting === true) {
var resJSON = {};
var message = url.search.substring(1);
message = window.decodeURIComponent(message).split('&');
var i = message.length;
while (i-- > 0) {
var v = message[i].split('=');
if (v[1].charAt(0) == "{") v[1] = $.parseJSON(v[1]);
resJSON[v[0]] = v[1];
}
if (fOpts && fOpts.finishCallback instanceof Function) {
fOpts.finishCallback(resJSON);
}
}
}
buildForm:函数(fList、fOpts){
如果(!(this.getLocalURL())返回false;
var iDoc=(this.frame.contentWindow)?this.frame.contentWindow.document:(this.frame.contentDocument.document)?this.frame.contentDocument.document:this.frame.contentDocument;
var newForm=iDoc.createElement('form');
var方法='POST';
var postrl=fOpts.serviceURL+'&callbackUrl='+this.startURL;
setAttribute('action',postrl);
setAttribute('method',method);
$(新格式)。追加(“”);
$(新格式)。附加(“”);
newForm=iDoc.body.appendChild(newForm);
this.isWaiting=true;
$(this.frame).unbind('load').load(function(){
Port.formControl.call(Port、this、fOpts);
});
newForm.submit();
},
formControl:函数(formEl、fOpts){
var-url;
如果(!(url=this.getLocalURL())返回false;
if(this.isWaiting==true){
var resJSON={};
var message=url.search.substring(1);
message=window.decodeURIComponent(message.split('&');
var i=message.length;
而(i-->0){
var v=消息[i]。拆分('=');
if(v[1].charAt(0)=“{”)v[1]=$.parseJSON(v[1]);
resJSON[v[0]]=v[1];
}
if(fOpts&&fOpts.finishCallback instanceof函数){
fOpts.finishCallback(resJSON);
}
}
}
在buildForm的函数调用周围添加了setTimeout逻辑。我认为这允许创建iframe,在使用成功的概要文件更新消息更新UI之前进行跨域访问
$.fn[pluginName].post = function(argObj) {
Port.init(function(){
setTimeout(function() {
Port.buildForm(argObj.JSON, {
serviceURL: argObj.service,
finishCallback: argObj.callback
});
}, 10);
});
};