0

Is it possible to block URLs with Tasker?

I'd like to block different sites from 9-5 everyday.

2 Answers 2

1

You can if your device is rooted. You need to add the URLs in the hosts file (/etc/hosts) like:

127.0.0.1 facecrook.com
127.0.0.1 liveminmin.com

and so on.

Note that you'll have to remount (as rw) your /system first using the commands:

adb shell
su
mount -o remount,rw /system

Use a file editor to do the editing and then remount the system in ro mode. Also, before editing, copy the default hosts file at some location say /sdcard/host_files/original/hosts and the modified hosts file at /sdcard/host_files/modified/hosts

Now with the Tasker:

  1. Create a time based profile as +Time and select your timing when you want URLs to be blocked.
  2. Create a task under the above profile and the action inside it should be +Code → Run Shell:
  • Type mount -o remount,rw /system in Command
  • Check Use Root
  1. Create a new action through +File → Copy File:
  • Tap the lens icon corresponding to From and select /sdcard/host_files/modified/hosts
  • Tap the lens icon corresponding to To and select /etc folder by holding it.
  1. Create another new action through +Code → Run Shell:
  • Type mount -o remount,ro /system in Command
  • Check Use Root
  1. Create this last action through +System → Reboot → select Normal in Type.
  2. Create another profile for the time you don't want URLs to be blocked using step1.
  3. Copy steps 2-5 and choose /sdcard/host_files/original/hosts in step 3 under From.
  4. Make Tasker an exception in any app (if you have) that disables Tasker from startup.

Enjoy!

0

In general, no. Tasker can't know when a URL is launched (my testing with the "Receive Intent" event had no success), nor does it have the necessary control over the browser to stop the page from loading.

That said, if I could find the time to get DolphinTasker published, then yes, you could do this with Dolphin Browser. But that's not an option at the moment.

You must log in to answer this question.

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