How to open multiple tabs from one HTML file

21,910

Solution 1

How about using a batch file? I just tried it in Windows 7 with Chrome and it opened all 3 URLs in the same window.

Make a plain text file with Notepad called file-name.bat. Then add this code:

start chrome.exe http://www.google.com
start chrome.exe http://www.yahoo.com
start chrome.exe http://www.microsoft.com

All you should have to do is double click it to run it. You may get a security warning (I didn't).

You could check this out too: Batch file for opening one of a list of URLs

Solution 2

<script type='text/javascript'>
(function(){
  //add this line for each website you want to open
  window.open("http://www.facebook.com/",'');
})()
</script>

there are more answers to this question that work here

Solution 3

Try this example. I hope this something like this is what you want. About popup blocked you have to configure your browser to allow popup opened from this page. The easiest that I know to bypass the popup blocker is put this page inside local server like apache and set your browser to allow popup from localhost.

<html>
<script>
function openLinks(){
links = document.getElementsByTagName('a');

 for (i = 0; i < links.length;i++){ 
   window.open(links[i].getAttribute('href'),'_blank');
   window.focus();
 }
}
</script>

<body onload="openLinks()">

<a href="http://google.com">google</a>
<a href="http://stackoverflow.com">stackoverflow</a>
<a href="http://facebook.com">facebook</a>
<!-- add other link -->

</body>
</html>
Share:
21,910
lekroif
Author by

lekroif

Updated on July 19, 2022

Comments

  • lekroif
    lekroif almost 2 years

    I work on many computers, which means they use default browser settings (There is no point in changing browser settings, because I will have to do it every time). I need to make an HTML file which will open a specific list of desired pages (think of this as opening all my bookmarks). For example I visit facebook, yahoo, and stackoverflow. I want to click that HTML file, and it will open these 3 sites on the same window (different tabs).

    Also would functionality like automatic login on all the sites be easy for implementation?

    Attention: Focus on a "portable" solution. Assume that you only have default browser settings. No setting up servers, changing browser settings and things like that. Imagine that you have 200 computers and you can sit on any one of them. You have only a flash-drive with some files on it. I want to click an HTML file, or some script or whatever, so that these pages open in my browser, without triggering the popup blocker.