I am trying to find a 1-click solution to open multiple websites in different tabs in the same window in Google Chrome. I know that I can put all websites in a bookmarks folder and right click > open all
(or middle click the bookmark folder), but that does not fit my needs.
To the best of my knowledge there is no way to launch multiple tabs using a non-user initiated javascript callback in Google Chrome. If that is the case, Chrome instead launches each website in a separate window as a pop-up (see here).
However, I managed to accomplish this task using a google Chrome App:
manifest.json
{
"name": "Open multiple tabs",
"version": "1.0",
"description": "Opens multiple tabs in the same window.",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["background.js"]
}
}
}
background.js
chrome.app.runtime.onLaunched.addListener(function() {
window.open("http://plus.google.com");
window.open("http://www.twitter.com");
window.open("http://news.google.com/");
window.open("http://bestofyoutube.com");
window.open("http://www.sci2.tv/#!/browse");
});
Most probably there is something wrong with my code, since more than half of the times, after a tab is loaded it crashes, displaying the "Aw shap! Something went wrong while displaying this webpage. To continue, reload or go to another page" error message.
Also, Google+ (plus.google.com) always displays the message "You have been signed out of Google+" (if the tab does not first crash), which will not go away even after reloading.
It does not matter if I pack the App before installing it or not.
Any help would be greatly appreciated.
As a bonus, can someone please explain why replacing
window.open(url);
with
chrome.tabs.create(url);
results in the App doing absolutely nothing?
Thanks, Nikos
OSX Mavericks, Chrome Version 35.0.1916.153