如何让Chrome在新标签中打开页面 [英] How to Make Chrome Open Pages in New Tabs
问题描述
我只想在新标签中打开所有页面......是关于Chrome还是我的代码?在格式化计算机之前,我可以用这段代码做到这一点,但现在第一个链接在新标签中打开,其他链接在新窗口中打开。我认为我的一些Chrome浏览器选项已被破坏或者某些内容...
for(var i = 0; i <2; i ++){
window.open(document.getElementById(threads)。getElementsByClassName(title)[i] .getAttribute(href));
}
那么你可以使用 chrome.tabs
API:
chrome。 tabs.create({url:http://www.google.com/});
请参阅以下文档: http://developer.chrome.com/extensions/tabs.html
致投票人关闭这个问题:
所有链接的可能的重复问题都是浏览器不可知的,所有的答案都说这样做是不可能的。另一方面,这个问题是特定于Chrome的问题,并且Chrome专用的API可用于为Chrome扩展程序提供这种功能。所以我不会说这个问题是重复的,或者对链接问题的答案是特别相关的。
I just want to open all pages in new tabs... Is it about chrome or my codes? Before formatting computer i can do that with this code, but now the first link open in new tab and the others open in new window. I think some of my chrome options are broken or something...
for (var i = 0; i < 2; i++) {
window.open(document.getElementById("threads").getElementsByClassName("title")[i].getAttribute("href"));
}
If you are writing a Chrome extension then you can use the chrome.tabs
API:
chrome.tabs.create({ url: "http://www.google.com/" });
See the documentation at: http://developer.chrome.com/extensions/tabs.html
To people who vote to close this question:
All of the linked "Possible duplicate" questions are browser-agnostic and all of the answers say that doing that is impossible. This question on the other hand is Chrome-specific and there is a Chrome-specific API that can be used to do just that for Chrome extensions. So I wouldn't say that this question is a duplicate or that the answers to linked questions are particularly relevant.
这篇关于如何让Chrome在新标签中打开页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!