Firefox – How to open a list of URLs in Firefox or SeaMonkey

firefoxseamonkey

I have a list of URLs in a text file, for example,

http://url1
http://url2
http://url3

I wonder how to open them each in one tab in Firefox (or SeaMonkey), without the hassle of creating a new tab, copying into address bar and hitting return for each URL?

My OS is Ubuntu 10.10. Both command line and GUI solutions are welcome.

Best Answer

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.

Related Question