2014-10-09 68 views

回答

2

谷歌做了一个星球大战新选项卡更换,它允许您查看默认的新标签页。它使用的网址是chrome-search://local-ntp/local-ntp.html。例如:

options.html:

<input type="checkbox"> Use default new tab page 

options.js:

var checkbox = document.querySelector("input[type=checkbox]") 
checkbox.addEventListener("click", function() { 
chrome.storage.sync.set({ defaultnewtab: checkbox.checked }) 
}) 

newtab.js:

chrome.storage.sync.get("defaultnewtab", function(storage) { 
if(storage.defaultnewtab) { 
    chrome.tabs.update({ url: "chrome-search://local-ntp/local-ntp.html" }) 
} }) 
+0

这并不总是可行的。扩展程序应该显示最后设置的新标签页,而不是Chrome的默认标签页。 – 2016-05-12 12:30:26

相关问题