Every so often (maybe every couple years) I accidentally close all my open Safari tabs and it becomes impossible to recover them. On iOS, you only have a couple minutes to reopen closed tabs before they vanish forever. Neither restoring from an iCloud backup or a local backup is capable of recovering closed Safari tabs after those crucial minutes come to pass. I know from experience: early tonight I had one of those moments and I’ve since restored my iPad three times in different ways in the hopes of recovering my 300+ Safari tabs.
Apple doesn’t make it easy to recover Safari tabs. Bookmarks, on the other hand, are saved to iCloud and can be reliably recovered within a few clicks.
I’m wondering if anybody could share a better workflow for backing up Safari tabs. I have a couple ideas myself of automations I could build, but I haven’t yet figured out if it’s even possible to build these scripts.
Cycle though each open window, right-click each tab group and choose “Copy Links,” then save the clipboard to a text file.
For each tab group or window, add a bookmark for all open tabs and name the bookmarks folder according to the current date.
Yes, tabs are notoriously volatile on Safari Before digging into a full export solution, have you considered dispatching them by their importance so losing all tabs isn’t as bad?
If it’s of any inspiration here’s how I handle my Safari browsing:
If it’s volatile and I’m fine losing (mostly news or tech articles), I leave it open in Safari
If it requires effort, I put it in a Tab Group (long article that requires concentration, tutorial, access to another device, create an account). I don’t use Reading List (it’s too clumsy on iPhone) but that could be an alternative for your needs on iPad/Mac.
If it’s unique and I don’t want to lose it, I export to Instapaper in a specific category (must-see video, recipe, some online game).
It’s a small chore but it keeps me on top of the topics I want to keep. Tell me if this helps.
If you have a mac handy it’s easy, just use applescript.
There are a lot of options, as an example the code below will copy all open tabs to a text document on the desktop:
set myURLs to {} tellapplication “Safari” toset myURLs tothe URL ofeverytabofeverywindow set text item delimiters to linefeed set myURLs to myURLs astext set text item delimiters to {} ifnot myURLs isequal to “” then do shell script "echo " & myURLs’s quoted form & “> $HOME/Desktop/URL_list.txt” endif
And here’s a variation with html. I use something similar to “save sessions” either manually or whenever I close Safari. The variable docText is html with two lists: One with links and tab names, and one with text urls, which gives you the option to click a link or easily copy the underlying url.
set todaysDate to (current date)
set the Title to ¬
"Saved Session - " & todaysDate as string
tell application "Safari"
tell window 1
set docText to "<h2>" & Title & "</h2>"
repeat with t in every tab
set tabName to name of t
set tabURL to URL of t
set docText to docText & "<a href=" & "\"" & tabURL & "\">" & tabName & "</a>" & "</br>" & linefeed as string
end repeat
set docText to docText & "</br>" & linefeed as string
repeat with t in every tab
set tabURL to URL of t
set docText to docText & tabURL & "</br>" & linefeed as string
end repeat
end tell
do shell script "echo " & docText's quoted form & "> $HOME/Desktop/URL_list.html"
end tell
tell application "Safari"
set docText to ""
set tabcount to number of tabs in the front window
--Repeat for Every Tab in Current Window
repeat with y from 1 to tabcount
--Get Tab Name & URL
set tabName to name of tab y of the front window
set tabURL to URL of tab y of the front window
set docText to docText & "- [" & tabName & "](" & tabURL & ")" & linefeed as string
end repeat
set the clipboard to docText
end tell