How do I get any browser available on Android to open a fixed set of urls on startup?


Question

How do I get any browser available on Android to open a fixed set of urls on startup?


Answer

This solution requires Tasker (paid; trial version here) app. It is tested on a OnePlus 6 running Android 10.



How do I get any browser available on Android to open a fixed set of urls on startup?



You can't, unless a browser app (doesn't matter which browser) is selected as default Browser app or is selected as default app to handle certain protocols (such as http, https, etc.). So this solution is assuming that one of the installed browser apps is already set as a the default Browser app or as default app for the said protocols. Otherwise, the solution would not work.


Before you proceed, create a text file in your Android (or copy into it) with a list of your URLs. Make sure that all URLs are separated with a common separator. A common separator can be a new line -- each URL limited to a separate line, or each URL separated by a comma, or anything that is easier for you to setup. I suggest separate line. Example:


https://www.urlone.com
https://www.urltwo.com
https://www/urlthree.com

You also need to make sure that each URL starts with a protocol identifier. In my example, it is https://. If you don't prefix the protocol, the intent that Tasker would be sending would not be resolved to our satisfaction.


Now, let's move on to Tasker. Following is a profile and a task (with actions) that you need to setup in Tasker. If you are new to Tasker, you can get yourself familiar with tutorials on the web.


Profile: Event → System → Device Boot


Task:



  1. System → Send Intent



    • Action: android.intent.action.VIEW

    • Cat: none

    • Data: https://www.google.com

    • Target: Activity

    • leave rest of the entries untouched



  2. File → Read File



    • File: use lens/search icon to select your text file containing list of Urls

    • To Var: %data



  3. Variables → Array Set



    • Variable Array: %urls

    • Values: %data

    • Splitter: press Enter key once so that new line is used as spliiter



  4. Task → For



    • Variable: %url

    • Items: %urls()



  5. Task → Wait → MS: 200



  6. System → Send Intent



    • Action: android.intent.action.VIEW

    • Cat: none

    • Data: %url

    • Target: Activity

    • leave rest of the entries untouched



  7. Task → End For




Alright. So what is happening here is that I am sending an intent to launch the default browser with URL https://www.google.com. I am reading the text file into an array, and than I am running a For loop on each element of that array. Each element is than used as a data (URL) to send the intent. That intent than is resolved and the tab with the corresponding URL is opened in the browser app. I am also using a wait/timer of 200 milliseconds so that the browser doesn't miss my URL when intents are resolved rapidly.


If your device is slow, you may have to increase the wait time.


Also, the reason I am launching the browser app in the first action is to make sure the app is loaded into the memory already. I had noticed that Tasker continued to fire the intents but the browser only loaded the URLs when it was ready.


This method worked for Firefox and Chrome (both with latest versions at the time of writing this answer), whenever any of them was set as the default browser app.


Note: for some reason which I didn't investigate into, Firefox didn't load all of my 42 URLs in the text file. 1-3 URLs were never opened. Worked fine on Chrome.


Try it out!


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