我正在嘗試製作類似於下圖的內容。使用彈出式欄的Chrome擴展程序
http://img696.imageshack.us/img696/8844/testi.jpg
不幸的是,我似乎無法得到它的擴展範圍內工作。我收到一個錯誤,指出「加載文檔時出錯」。上面的屏幕截圖是使用iBox JavaScript本地製作的HTML完成的。有沒有其他的JavaScript庫允許我加載我的彈出式HTML,就像它在圖標欄中的圖標一樣?
這是怎樣的代碼在本地實現打開彈出:
document.addEventListener('keydown', function(e){
if (e.keyCode == 81 && e.altKey && !e.shiftKey && e.ctrlKey) {
iBox.showURL('search.html');
}
}, false);
這是iBox的庫函數:
showURL: function(url, title, params) {
showInit(title, params, function() {
for (var i=0; i<_pub.plugins.list.length; i++) {
var plugin = _pub.plugins.list[i];
if (plugin.match(url)) {
active.plugin = plugin;
plugin.render(url, active.params);
break;
}}});}
這是XMLHTTP請求:
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http = new XMLHttpRequest();
if (http.overrideMimeType) {
// set type accordingly to anticipated content type
http.overrideMimeType('text/html');
}
}
後的代碼片段:我也許能提供幫助。 – jldupont 2009-12-18 15:17:09
已更新,請告訴我,您是否在尋找 – Guibone 2009-12-18 15:32:05
以及「search.html」文檔位於何處? – jldupont 2009-12-18 15:34:40