open multiple URIs with one click (similar to desktop Firefox "open all in tabs")


Question

I want to open a folder of about 20 bookmarks in a web browser with one click. So far I have not found any browser or any addon that will do this, but maybe I am overlooking something obvious.



An alternative option is a very good speeddial-type app that will help me track which which bookmark was opened last so I can manually work through a list of 20+ bookmarks.



The problems I am trying to solve are:




  1. make it convenient to open many bookmarks at once.

  2. if I have to open them one at a time, provide a way for me to keep track of which bookmarks have already been opened in this session so I can manually open the next one as I go through the large list of bookmarks.



I have already tried Firefox sync, Dolphin Connect, XMarks and several other solutions and none of them do what I need.


Answer

It's not a perfect solution but it should help you out. Following preformatted text is a very simple script that can open a series of bookmarks which are tagged with a particular keyword. Each bookmark would be opened in the browser selected as default for the bookmark's URL type.



Script




#!/system/bin/sh

list=/data/media/0/bms_list;
keyword="$1";
browser="$2";
mkfifo $list;

# force-stop default browser
[[ "$browser" ]] && am force-stop "$browser";

# get URL of bookmarks associated with the supplied keyword
content query --uri content://org.mozilla.firefox.db.browser/bookmarks --projection url --where "keyword='$keyword'" | busybox sed 's/.*url=//g' > $list &

# Take each URL from the saved output and launch it using the default browser
while read line; do
am start -a android.intent.action.VIEW -d "$line" --activity-exclude-from-recents;
sleep 1;
done < $list
rm $list;


Prerequisites



Here are the hard prerequisites for the script to work:




  • You must have root access1.

  • Busybox must be installed and available under PATH variable.

  • Firefox Browser for Android is required. It is required because Chrome doesn't support tags, the bookmark folders are not visible through Chrome's content provider and it would be painful to me if I begin to parse Chrome's bookmarks file available in its private directory. I didn't test with other browsers so that's another reason why I made Firefox a prerequisite.



    It is to be noted that you're not required to use Firefox browser as your daily driver, but only to make and keep bookmarks in it for them to be sorted through particular keywords. Firefox browser doesn't support multiple keywords for bookmakrs, as of v44.0.2.



    To add a keyword: Bookmark a link in Firefox, go to Bookmarks tab, long press on your bookmark → Edit → add your keyword under Keyword.



    I've not tested with a keyword containing a space so if the script doesn't work with a keyword containing space(s), replace space(s) with _ in your bookmarks and then try the script.


  • I've only tested this solution with Firefox and Chrome so I can't guarantee that this would work with any browser. However, common sense dictates that if it is a browser for casual browsing, it would have registered for an intent having a URL data type, so the browser should have no problem with my script.



    Note: For some reason, Firefox couldn't handle the series of bookmarks after some time and crashed. (It actually crashed every time.) On the other hand, Chrome v45.0.2564.95 didn't crash even for once.




Here's how the script can be executed after saving it under /sdcard with extension .sh:



Running the script



Install a terminal emulator app and execute:




su -c 'sh /sdcard/FILE KEYWORD BROWSER'


Example:




su -c 'sh /sdcard/bms_launch.sh Stack_Exchange com.android.chrome' # this would launch all the bookmarks tagged with the keyword Stack_Exchange in the default browser com.android.chrome


Things to know:




  • FILE: file name of the script, e.g.: bms_launch.sh

  • KEYWORD: the keyword to which all associated bookmarks should be searched for and be launched in default browser

  • BROWSER: package name of your default browser. To know the package name, follow View app's full package name?



    Note: it is not necessary to provide package name of the default browser. I used it because I had to force-stop Chrome as Chrome was causing some complication without a force-stop.




Convenient execution



How you would execute this script in your device is upon you to decide. I can recommend these two methods. Any of them would be enough.








1 Root access is needed because I don't know how to generate (and easily parse) a list of bookmarks from some browser dynamically. Even if I can have such a list, I wouldn't be able to go on unless I know that those bookmarks can be sorted using a tag or a keyword. This is why I chose Firefox and root access.



The dependency on a single keyword might cause inconvenience but I've given you a (possibly good) idea. If your preferred browser supports multiple tags/keywords for bookmarks then you should have no problem in tweaking my script per your needs.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes