How to open a list of URLs in Firefox or SeaMonkey?
You can save the following to a HTML file:
<!doctype html>
<html>
<head>
<title>Open Windows</title>
<script>
function openWindow(){
var x = document.getElementById('a').value.split('\n');
for (var i = 0; i < x.length; i++)
if (x[i].indexOf('.') > 0)
if (x[i].indexOf('://') < 0)
window.open('http://'+x[i]);
else
window.open(x[i]);
}
</script>
<style>
html, body
{
height : 99%;
width : 99%;
}
textarea
{
height : 80%;
width : 90%;
}
</style>
</head>
<body>
<textarea id="a"></textarea>
<br>
<input type="button" value="Open Windows" onClick="openWindow()">
<input type="button" value="Clear" onClick="document.getElementById('a').value=''">
</body>
</html>
Now load the file in Firefox, copy the list of URLs in the textarea and click Open Windows
.
A simple
firefox $(cat file.txt)
should suffice. It will pass each link as an argument to the firefox
command, as long as every link is separated by whitespace.
On windows you can create a batch file (named say, multiurl.bat):
@echo off
for /F "eol=c tokens=1" %%i in (%1) do "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" %%i
and then run multiurl.bat urls.txt
from the command line and it will load the URLS in new tabs if FireFox is already open, or it will run it and then load the URLS.
On Mac OS X, save the following script as openurls.sh
, run chmod +x openurls.sh
in Terminal, and then type ./openurls.sh
from the same directory.
#!/usr/bin/env bash
while read line ; do
open -a Firefox "$line"
done < "/path/to/file-with-urls.txt"