0

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

0

1 Answer 1

1

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!

2
  • Do you know if it is possible to use a free app like Automate or Macrodroid to do this?
    – mcarans
    Commented Jan 12, 2021 at 17:37
  • 1
    I tried them (because Tasker is a paid app) but could not get them to do this. :(
    – Firelord
    Commented Jan 12, 2021 at 17:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .