2013-07-20 45 views
3

我正在嘗試在Chrome擴展中創建一個Google搜索欄,它將在新瀏覽器選項卡中打開搜索。我的manifest.json看起來是這樣的:在Chrome擴展中創建一個將在一個新標籤中打開的搜索欄

{ 
"name": "Search", 
"version": "1.0", 
"manifest_version": 2, 
"description": "Search", 
"browser_action": { 
"default_icon": "search.png", 
"default_popup": "popup.html" 
    } 
} 

我的HTML看起來像這樣:

<div id="search"> 
<form method="get" action="http://www.google.com"> 
<div style="border:0px solid black;padding:2px;width:20em;"> 
<table border="0" cellpadding="0"> 
<tr><td> 
<input type="text" name="q" size="25" 
maxlength="255" value=""<textarea placeholder="Search Google"></textarea> 
<input type="submit" value="Search" /></td></tr> 
</table> 
</div> 

此html頁面工作正常,在正常browswer但不是作爲一個Chrome擴展。我認爲我需要授予訪問我的選項卡的權限,但我是製作Chrome擴展的新手,所以我對剛性manifest.json標記有點麻煩。

回答

3

添加target="_blank"屬性表單,像這樣:

<form method="get" action="http://www.google.com" target="_blank"> 

MDN Reference

+0

由於它的工作原理 – user2597417

相關問題