Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Is there any way to block access to a particular website through the stock Android browser? I'm running Android 2.3 on an HTC Desire S.

share|improve this question
    
To filter adult content in web browser apps you can use "Mobile Security" which has parental controls plus backup and antivirus features for mobile. –  patchie Dec 4 '11 at 14:09
add comment

1 Answer

If you have root, you can mount the systems partition as editable and edit the hosts file and set the site in question to redirect to 127.0.0.1. This is somewhat complicated voodoo, however, and I wouldn't recommend it if you don't know what I'm talking about already.

However if you don't want to do this manually and have rooted your phone, the app Hosts Editor is a nice little single purpose utility just for this.

If you're up for the voodoo, and have ADB installed:

  1. From the terminal invoke the adb command with remount option otherwise you will get "failed to copy 'hosts' to '/system/etc/hosts': Read-only file system".

    adb remount

  2. In the terminal pull the default hosts file from /system/etc/hosts or /etc/hosts which is the symlink of the file not only for backup purpose but also to get the file to modify.

    adb pull /system/etc/hosts <path to pull hosts file to>

  3. Modify the file according to your needs. (eg) 127.0.0.1 www.somewebsite.com

  4. Push the file back to the phone:

    adb push <path you pulled hosts file to>/hosts /system/etc/

  5. That's it. You can check it out from the shell:

    adb -e shell

    cat /system/etc/hosts

source

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.