Send Vivaldi Tabs to iOS (via Safari Reading List)

safari
sync
web_browser
applescript
javascript

#1

Despite being a dogmatic and bullheaded Safari user, and despite what I said December 2017, I started to – tentatively – make friendship with the Vivaldi browser :wink:

It just has a bit too many goodies that can't be ignored… (@ronald, you were right!)

Of course, this doesn’t go without problems. My personal main problem is that Vivaldi has no sync counterpart on iOS: I cannot leave my desktop and simply continue browsing where I left off, on my iPhone/Pad, as I’m used to with Safari on Mac + Safari on iOS.

So I thought it would be a good idea to leverage Safari’s sync glory for Vivaldi.

So far, the easiest (not necessarily the best) way I found is via Safari’s Reading List, which perfectly syncs to the Reading List on iOS:

This little script creates a Safari Reading List entry based on the active tab in Vivaldi:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application id "com.vivaldi.Vivaldi"
  tell window 1
    tell active tab to set {frontURL, frontTitle} to {URL, title}
  end tell
end tell

tell application id "com.apple.SafariTechnologyPreview"
  add reading list item frontURL with title frontTitle
end tell

Note: If you prefer Safari over Safari Technology Preview then replace the app ID in the second Tell block with com.apple.Safari.

The newly created Reading List entry in Safari should get transferred to your iPhone automatically (if your ecosystem is in good conditions).


OK. If you want to sync more than one tab to iOS, then try this script:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

set {allURLs, allTitles} to {{}, {}}

tell application id "com.vivaldi.Vivaldi"
  tell window 1
    repeat with t in tabs
      tell t to set {end of allURLs, end of allTitles} to {URL, title}
    end repeat
  end tell
end tell

tell application id "com.apple.SafariTechnologyPreview"
  repeat with n from 1 to count of allURLs
    add reading list item item n of allURLs with title item n of allTitles
  end repeat
end tell

This will create Safari Reading List entries from all tabs of the frontmost Vivaldi window.


You can launch the scripts as KM macro or as LaunchBar action, or whatever else you prefer. Safari doesn’t need to be running when you launch the script: The “tell” will activate Safari and the script should get through, even if Safari opens with a couple of tabs from its last session. (If not, then experiment with some delay.)


And, a question for the JavaScript experts here:

Vivaldi allows us to select multiple tabs (via Cmd- or Shift-Clicking). This would be a perfect way to send exactly the tabs you really want to the Reading List.

Unfortunately there doesn’t seem to be a “selected” property for tabs in Vivaldi’s AppleScript dictionary (only “active”).

As a workaround I can select some tabs, send them to a new window, run the second script (the one that grabs all tabs) and then send the tabs back to the original window. A bit clumsy.

So, the question: Is there any more elegant, JavaScript way to get the URLs (or indices) of selected tabs in Vivaldi?

(As some may know, I’m not very good with JS…)


Edit 2019-06-10

2nd script: Corrected (cosmetic) typo in variable name.


Evaluating Chromium-Based Web Browsers (alternates to Google Chrome)
split this topic #2

2 posts were split to a new topic: Useful Extensions for Chromium Browsers (Google, Brave, Vivaldi)