HowTo: Block websites in every browser
asked 2015-11-29 13:31:26 +0200
This post is a wiki. Anyone with karma >75 is welcome to improve it.
To block certain websites in every browser on your Jolla Phone, follow these simple steps:
Blocking websites
Make sure you have a Jolla account and the Jolla device can access the Jolla Store.
Go to |- Settings | System Settings | Developer Mode -|.
Activate „Developer mode“. Because your Jolla device can access the Jolla Store, a Terminal app is installed now.
Activate „Remote connection” (either enter and [Save] a password or [Generate] it; if you generate it, you have to edit it slightly before the [Save] button becomes available).
Open the Terminal app installed during step 2. The SailfishOS command prompt will appear. You are logged in as user, the prompt is a "$".
Get root access:
Enterdevel-su
[Enter].When requested: Enter your password (as specified during step 4) and [Enter]. The prompt changes from "$" to "#". Now, you have root access to the Jolla device! Be careful!
Go to root:
Entercd /
[Enter]Create a backup of the hosts-file:
Entercp /etc/hosts /etc/hosts.bkp
[Enter]Add Website you want to block to the file (e.g. www.google.com):
Entersh -c 'echo "127.0.0.1 www.google.com" >> /etc/hosts'
[Enter]
(Do only change the adress, nothing else!)
Important:Do not forgett "www." and remember that some websites like facebook do have a mobile version aswell (m.facebook.com)Repeat Step 10 for every website you want to block. This can be done at any point in time.
How it works: Basicly you are telling you're phone to redirect every request for the specified websites back to the phone itself. That comes handy when you have a html-server running on your phone with a custum html file with e.g. a warning. Without a server it will simply say: Connection Error as if the site would not exist.
Reloading BackUp
If you want to unblock all websites, simply restore the backup:
Enter cp /etc/hosts.bkp /etc/hosts
[Enter]
Then agree to overwrite the file: y
[Enter]
PS: Some steps are copied from https://together.jolla.com/question/30926/howto-install-google-play/ beacuse they're identical.
This is the same principle used here to do ad blocking: https://together.jolla.com/question/28922/how-to-adblock-for-sailfish-browser/#post-id-53277
drcouzelis ( 2015-11-30 15:46:37 +0200 )edit