How do I get any browser available on Android to open a fixed set of urls on startup?
How do I get any browser available on Android to open a fixed set of urls on startup?
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:
System → Send Intent
File → Read File
Variables → Array Set
Task → For
Task → Wait → MS: 200
System → Send Intent
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!
Q & A