Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Browsing history leaving out some sites only

Tags:

Using the function below I am trying to get the LAST url that the user visited from Chrome Browser on their Android Phone. This function works very well for most sites, but does not work for "www.reddit.com".

The url variable below updates if I go to "www.google.com", "www.hulu.com" or "www.kayak.com" but will not update if I go to "www.reddit.com".

It does update if I go to "m.reddit.com". Same problem with facebook, detects m.facebook.com but not www.facebook.com.

I don't understand What's the difference between "www.reddit.com" and "m.reddit.com" that Android records one but not the other.

What change do I need in the code to detect ALL URL ACCESSES?

public String returnLastChromeURL(int browserCode) {     String[] proj = new String[] { Browser.BookmarkColumns.DATE,             Browser.BookmarkColumns.TITLE, Browser.BookmarkColumns.URL };      String dateTime;     Uri uriCustom = Uri             .parse("content://com.android.chrome.browser/bookmarks");     String sel = Browser.BookmarkColumns.BOOKMARK + " = 0"; // 0 = history,                                                             // 1 = bookmark     try {     Cursor mCur = mContext.getContentResolver().query(uriCustom, proj, sel,             null, BookmarkColumns.DATE + " ASC");     mCur.moveToFirst();     mCur.moveToLast();          dateTime = mCur.getString(mCur                 .getColumnIndex(Browser.BookmarkColumns.DATE));         title = mCur.getString(mCur                 .getColumnIndex(Browser.BookmarkColumns.TITLE));         url = mCur.getString(mCur                 .getColumnIndex(Browser.BookmarkColumns.URL));          mCur.close();     } catch (Exception e) {         dateTime = String.valueOf(System.currentTimeMillis());         title = "";         url = "empty_list";     }      return url; } 

Some more info from my debug:

  • When I try this on a Genymotion Emulator, all websites (including sites like www.reddit.com get detected ok). On a real phone www.reddit.com does not get detected.
  • Sites the code will detect OK: www.kayak.com' (redirects towww.kayak.com/mn),www.hulu.com(loads mobile version of site though url stays www.hulu.com),www.google.com` (same story as the hulu).

Seems like that the sites that load the pure desktop version of the site, do not get detected

like image 850
user1406716 Avatar asked Apr 21 '15 15:04

user1406716


People also ask

How do I stop certain websites from saving my history?

Click on Chrome Menu button and select Extensions from Tools. In the Extensions page, look for the extension History Site Blocker and click on the Options link next to it. All you need to do now is write down the full root level URL of the website you want to remove from the browser history tracer.

Why does my search history appear on other websites?

Why is my Google search history showing up on other devices? The Google search history or the browsing history and bookmarks will appear on other devices if the browsers are synced. Or, you are using the same Google account for both devices.

Why does my browser history keep disappearing?

Your Chrome history has disappeared if the browser settings related to history weren't correct. To restore the history in Chrome, you can try to check the User data folder for previous versions. Switch to another browser and prevent this problem from happening again.

How do I get Google Chrome to stop showing previous searches on Android?

In the Google settings page, tap Search. Now under Privacy & accounts, look for the “Show recent searches” setting and uncheck the box next to it. That's all! You should no longer see recent Google searches on your Android device.


1 Answers

This is because you never visit the desktop domain on your mobile , actually each time you visit facebook on your mobile ( or any other website that detects your navigator ) it will automatically redirects you to the mobile website , redirections will not be saved in history unless page loads , which never happens.

Check the following screenshot taken from my true N7100 galaxy note2 and my windows browser :

if you are using chrome browser you can request desktop website ( which is not a reliable solution as user will have to do this manually ).

another solution is to override redirection method which will not work due to XSS policy.

so a better solution is to fake your browser and convince the server that you are using a desktop browser check this answer .

The simulator on desktop uses device user agent which will count as desktop browser. screenshot

like image 146
ProllyGeek Avatar answered Nov 10 '22 00:11

ProllyGeek