7

How to block some url (site) on android default browser?

I want to restrict user to access some url which are black listed.

eg. If i want to block facebook then phone built-in app browser will not access this facebook site.

ks1322
  • 33,961
  • 14
  • 109
  • 164
PrvN
  • 2,385
  • 6
  • 28
  • 30
  • um... What use is this? – Alex Gittemeier Jul 01 '13 at 06:51
  • Gosh!! Now someone wants to block access to certain sites in my personal phone.. I must kill himm b4 he succeeds... – CRUSADER Jul 01 '13 at 06:56
  • @CRUSADER maybe he wants a tool to control access for certain websites like a parenting tool. That sounds good idea. – Alamri Jul 01 '13 at 06:58
  • @CRUSADER: actually, there are plenty of good reasons to have a web filter... (not only parental control) for example, to prevent users to open malicious websites. – Paolo Rovelli Oct 22 '13 at 09:56
  • @PrvN: Did you finally come up with a solution? I have a similar problem: http://stackoverflow.com/questions/19453841/developing-a-web-monitor-in-android – Paolo Rovelli Oct 22 '13 at 12:50

3 Answers3

8

Do you want to block some websites on a user's device by letting them install an app?

If that is the case, it will only work if they are rooted. If they are, then you could add an entry of the url to the hosts file and redirect it to another ip address (eg 127.0.0.1). But since they need to be rooted, they will probably get a popup asking for permission to access root. This could raise some suspicion with the user.

On a device that's not rooted, preventing the standard browser from accessing a certain website is not possible by installing an app.

Siebe
  • 942
  • 2
  • 10
  • 27
  • I am in need of functionality where when a user types a url on the browser and searches for it, my app should be able to get that url first and then continue its work based on my permission. Can u please help me with this issue – aravind varma Dec 13 '14 at 10:21
  • 1
    This is five years old but i've come across an app called BlockSite which uses accessibility permissions to achieve exactly this. Does anyone have an idea of how it achieves this ? Want to create a custom version of that – BruceWayne Nov 13 '18 at 19:08
1

You can't prevent the user from using their browser on their device to access any site.

If you want to do this, make your own browser and replace the one on their device with it (may not be possible without root).

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
  • 4
    For somehow Kaspersky in Android is able to block access to websites that marked as blacklisted in thier database. – Alamri Jul 01 '13 at 06:59
0

There's a work around which is using a VPN service to monitor and filter all the traffic.

An example of this is the NetGuard project:

https://github.com/M66B/NetGuard.

Of course, the user should give his permission to permit this service to take control of the traffic. And in some systems, some system applications are not directed to this service (I've noted that the Samsung Web Browser traffic is not sent through the system VPN).

Adrián Rivero
  • 161
  • 1
  • 9