這是我的background.html文件,它在當前選項卡中打開時工作正常,但我希望它在新選項卡中打開,我做錯了什麼?在谷歌瀏覽器擴展程序中打開新選項卡
<html>
<head>
<script>
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {
var action_url = "javascript:location.href='http://www.reddit.com/submit?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)";
chrome.tabs.create(tab.id, {url: action_url}, function(tab));
});
</script>
</head>
</html>
確保您action_url開頭:'HTTP://'或'的https://' –