我有一个以标签格式加载多个网址的插件。对于某些网站的网址,可以看到它在加载时挂起。当我尝试在firefox浏览器上加载相同的URL时,它不会挂起。
需要帮助。为什么firefox在addon的情况下表现不同?示例代码:
function addTabsForCounter(tabCounter) {
var tabHtml = $("<tab>").attr("onclick", "showTab(" + tabCounter + ")").attr("id", "tab_button" + tabCounter).attr("style", "width:140px;").attr("crop", "right").attr("label", "TAB " + (tabCounter+1));
$("#all_tabs").append(tabHtml);
var view = $("<browser>").attr("id", "view" + tabCounter).attr("type", "content-targetable").attr("src", "").attr("showcaret", "true").attr("flex", "100").attr("tooltip", "browserTooltip");
var mView = $("<label>").attr("id", "view_meta" + tabCounter).attr("style", "display: none;");
if(tabCounter === 0) {
$("#tabbox_outer_hbox").after(view);
$("#view0").after(mView);
} else {
var prev = (tabCounter-1);
$("#view" + prev).after(view);
$("#view_meta" + prev).after(mView);
}
$("#view" + tabCounter).get(0).addEventListener("DOMContentLoaded", onBrowserDOMContentLoad, true);
$("#view" + tabCounter).get(0).addEventListener("DOMTitleChanged", onBrowserTitleChange, true);
$("#view" + tabCounter).get(0).addEventListener("keypress", onKeyPressInBrowser, true);}
function setupMappingLayout(currenta, currentc, Item, tabCounter) {
Item.startTime = new Date().getTime();
addTabsForCounter(tabCounter);
$("#view_meta" + tabCounter).val(JSON.stringify({
'asin': currenta,
'comp': currentc,
'zipregion' : getRDefault(Item),
date: " "
}));
refreshCountView();
$("#view" + tabCounter).get(0).loadURI(Item.url);
Item.status = "LOADED";}
注意:原始代码变量名称在复制之前已被修改,请忽略任何此类错误。