8

I don't like having my searches and web history hanging around forever. Therefore, I wonder: Is it possible to automatically clear browsing data on exit in Google Chrome? If it cannot be done with Chrome, do you know of any other good web browsers with this capability?

P.S. I am not willing to root my device just for this purpose. Therefore, I'm looking for a solution which does not require root access.

  • Hi and welcome to Android.SE! I haven't upvoted your question. It needs work. Please [edit[ it to address the following two issues. 1. Your question asks about incognito mode, but it seems to me that such a thing would be overkill (especially in case your device crashes while you're surfing the web). Really, you'd prefer a "clear browsing data on exit" option, right? 2. Do you insist on using Chrome? How open are you to the idea of switching to a different web browser, such as Firefox? – tealhill supports Monica Aug 6 '15 at 14:33
  • Thanks! You're right about incognito mode probably being overkill. I took your advice and made the necessary edits to my question. I decided to try Firefox out as well, and I discovered that it has on option to clear browsing data on exit, but you do have to tap the menu button and select quit. Still much easier than on chrome though! – Phillip Aug 6 '15 at 15:58
  • 1) How do you exit the Chrome? Do you simply swipe it out from Recent tasks list, or some other way? 2) Which Lollipop version and Android device is it? The latter isn't important but it's good to tell us. – Firelord Aug 6 '15 at 16:03
  • Yes, I just close it by swiping it off of the recent tasks list. I have a Samsung Galaxy S4 from sprint (SPH-L720) running Android 5.0.1. – Phillip Aug 6 '15 at 16:08
  • @Phillip: Thank you for editing your question. I have now finally upvoted it. :) – tealhill supports Monica Aug 13 '15 at 0:42
5

I would use firefox. It has an option to clear on exit. You do have to go to the menu (which you can access by tapping the menu icon) and hit quit every time, but seeming as there is no way I know of in chrome, It's better than nothing. Firefox does take some getting used to though, so switch with caution.

  • It seems that OP is already aware of this method. But it is still an answer though! Anyhow, could you link the app in the answer? Also, this "quit" feature has to be activated first to show up in Menu. Please mention it as well. – Firelord Aug 6 '15 at 21:27
  • OP asked about Chrome, not Firefox. – user598527 Mar 29 '17 at 7:50
  • @user598527 Question was originally written for firefox, then later edited. – typecasto Apr 9 '17 at 4:58
  • @LarsonAshcroft: There's nothing about Firefox in revision history. – user598527 Apr 9 '17 at 6:41
  • @user598527 Guess i'm mistaken then. Sorry about that, don't know what i was thinking. – typecasto May 1 '17 at 1:01
4

It's not possible with Chrome on a non-rooted device unless an app has access to Chrome's data directory, which could be the case if that app is owned by Google, or it's a Chrome plugin. Both type of apps doesn't exist as of now. So the short answer i.e. without root access, would be NO, you can't automatically clear browsing data on exit in Chrome for Android.


That said, somebody owning a rooted device may come looking for an answer in future. Here we go with a solution!

Note that this solution is reached by Trial and error. I experimented something and it seemed to work perfectly on my devices running Android 4.2.1, 4.4.2 and 5.0.2, and using Chrome v43.0.2357.93, which means I don't claim any knowledge of what the files (mentioned below) actually do or are used for.

About Chrome's data directory

  • Location of Chrome's data directory is /data/data/com.android.chrome.
  • Most of the browsing data (e.g. History, Top sites, Web Data, Cookies, Log in Data) is under /data/data/com.android.chrome/app_chrome/Default, which is the profile path.
  • Opened tabs are under /data/data/com.android.chrome/app_tabs/0/. 0 is the UID of primary user.

All we're going to do is delete the files responsible for resuming the previous browsing data when Chrome is loaded again. We'll simply use a script to delete those files and the deletion will be automated by .

Script

#!/bin/sh

data_dir='/data/data/com.android.chrome';
data_ac_dir=$data_dir/app_chrome/Default;
rm -f $data_ac_dir/History* $data_ac_dir/Web\ Data* $data_ac_dir/Cookies* $data_ac_dir/Visited\ Links $data_ac_dir/Favicons* $data_ac_dir/Top\ Sites* $data_ac_dir/Login\ Data* $data_dir/app_tabs/0/* $data_dir/app_chrome/Local\ State;

The script is very simple.

  1. First line is a shebang.
  2. Lines starting with data are creating variable and feeding directory location as the value.
  3. rm -f is to remove forcefully the files viz. History, Web Data, Cookies, Web Links, Favicons, Top Sites, Login Data, app tabs, Local State. * is a wildcard.

Note that this solution would not affect the Bookmarks or Preferences.

However, if you want even Bookmarks and Preferences to be cleared, simply add the following command in a new line at the bottom of the script:

rm -f $data_ac_dir/Preferences $data_ac_dir/Bookmarks*;

Save the file as Del_chrome_data.sh (.sh is important), push it into the root directory (/sdcard) of internal SD card and make it executable using as:

adb shell su -c 'chmod 667 /sdcard/Del_chrome_data.sh'

If you use a terminal app, do:

su
chmod 667 /sdcard/Del_chrome_data.sh

Check chmod to know about its usage.

Also, I do not change my script permissions in the manner noted above. I simply make them executable in my Linux machine and then push them into my Android device.

Instructions for Tasker

  1. Install and launch Tasker. Its accessibility service needs to be turned on for application based profile.

    Go to Settings → Accessibility → Tasker →On→OK.

  2. Under Tasks create a task named Del_chrome_data.
  3. Create an action in it through +Code → Run Shell, and fill these details:

    • Command: sh /sdcard/Del_chrome_data.sh
    • Check use Root
    • Store Errors in: %Catch
  4. Under Profiles create an application based profile through +Application → choose All, and Invert at the bottom → select Chrome.
  5. Link the task Del_chrome_data in it.

(Here is the exported profile, in case you run into trouble.)

Now, you may simply launch Chrome, do your browsing, open other apps, come back to Chrome, and nothing would seem to be affected.

Remove the Chrome from recent tasks list, launch Chrome, and voila! you would notice that the previous browsing data has been purged automatically.

You can also configure Tasker to run the task based on time, if you desire time based removal of browsing data.

Note: It took around 2-5 seconds on my devices to purge the files. Perhaps, those devices are slow.

We're good to go!

  • Tasker costs money. It would be more useful if you would edit your question and provide instructions which also work with a freeware alternative to Tasker. Your answer is still useful, though; +1. – tealhill supports Monica Aug 13 '15 at 0:45
0

I don't think it is possible because Chrome doesn't have lots of personalization.

Instead, try Maxthon Web Browser that allows you to surf the Internet without saving the chronology.

  • But does Maxthon Web Browser let you automatically clear browsing data on exit, or must you manually enter some "incognito mode" every time you use it? – tealhill supports Monica Aug 13 '15 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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