如何在 Firefox 或 SeaMonkey 中開啟 URL 清單?

如何在 Firefox 或 SeaMonkey 中開啟 URL 清單?

我有一個文字檔案中的 URL 列表,例如,

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

我想知道如何在 Firefox(或 SeaMonkey)的一個選項卡中打開它們,而無需創建新選項卡、複製到地址欄並為每個 URL 按下回車鍵?

我的作業系統是 Ubuntu 10.10。命令列和 GUI 解決方案均受到歡迎。

答案1

您可以將以下內容儲存到 HTML 檔案中:

<!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>

現在在 Firefox 中載入該文件,複製文字區域中的 URL 列表,然後按一下Open Windows

答案2

一個簡單的

firefox $(cat file.txt)

應該夠了。它會將每個連結作為參數傳遞給firefox命令,只要每個連結都用空格分隔即可。

答案3

在 Windows 上,您可以建立一個批次檔(名為 multiurl.bat):

@echo off    
for /F "eol=c tokens=1" %%i in (%1) do "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" %%i

然後multiurl.bat urls.txt從命令列運行,如果 FireFox 已打開,它將在新選項卡中載入 URL,或者它將運行它,然後載入 URL。

答案4

在 Firefox 中開啟文字文件

file:///C:/URLTextFile.txt
  1. 選擇整個連結
  2. 右鍵單擊它
  3. 點擊“在新分頁中開啟連結”

相關內容