2013-09-29 68 views
1

大道!簡單的Chrome擴展但有問題?

親愛的人..

我想使我的「谷歌自定義搜索代碼」

顯示從我在擴展彈出(popup.html)網站

我的搜索結果的延伸在從中進行擴展時遇到問題。

  1. 當我從加載本地計算機的iframe彈出窗口顯示的文本,但搜索對話框中沒有顯示。

  2. 當我加載從Google雲端硬盤的iframe iframe中被示出,但它需要將近3 4秒加載。

  3. ------------------(第3號我成功解決了) 鏈接沒有在新標籤頁中打開我感到太多請幫我打開鏈接在新標籤中? (在谷歌搜索API有一個選項,搜索功能>高級>目標鏈接...我把這個值_blank)

非常感謝!

的代碼如下所示。

的manifest.json

{ 
    "name": "Instant Search!", 
    "description": "Search My Blog Instantly!", 

    "version": "0.1", 
    "manifest_version": 2, 
    "browser_action": { 
     "default_popup": "popup.html", 
     "default_title": "Search My Blog" 
    } 

} 

Popup.html

<html> 
<head> 

</head> 
    <body> 
     <iframe width="400" height="400" 
      seamless="seamless"src="/QS.html"></iframe> 
    </body> 
</html> 

的iframe頁面

<!DOCTYPE html> 
    <html> 
    <head> 
<style> 
.cse input.gsc-input, input.gsc-input { 
background-image:url('/blank.gif')!important; 
} 
</style> 
    </head> 
<body> 
<script> 
    (function() { 
    var cx = '009043611225946488903:ntz9nyqubzw'; 
    var gcse = document.createElement('script'); 
    gcse.type = 'text/javascript'; 
    gcse.async = true; 
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + 
     '//www.google.com/cse/cse.js?cx=' + cx; 
    var s = document.getElementsByTagName('script')[0]; 
    s.parentNode.insertBefore(gcse, s); 
    })(); 
</script> 
<gcse:search></gcse:search> 
</body> 
    </html> 
+1

兩種可能的問題:1)你的iframe中(將其移動到一個單獨的'foo.js'和包括它與'