machinateur / android-chrome-tab-transfer

A tool to transfer google chrome tabs from your android phone to your computer using `adb`.
MIT License
91 stars 10 forks source link

Transferring tab history? #20

Closed UtopianElectronics closed 1 year ago

UtopianElectronics commented 1 year ago

Google's tab sync feature remembers each tab's history, which is a convenient thing to have. This tool doesn't seem to do this. Is there any way to add this functionality to it?

machinateur commented 1 year ago

I don't think this is possible. The CDP HTTP endpoints do not seem to provide such extended information, though it might be available through some web-socket interaction.

Either way, this would be something beyond the targeted functionality of this tool, which is to be able to transfer the currently opened tabs from an android phone to the pc and back.

UtopianElectronics commented 1 year ago

I see. Is there any way to at least identify the tabs that have a history and close the ones that had been opened directly (without any history), and sync the remaining tabs using Google's own syncing?

machinateur commented 1 year ago

As said, to my knowledge there is no way to access the history directly. At least, there is no documented way of reading it programmatically.

I guess that's a design decision, probably for security/privacy reasons.

Well, at least for mobile browsers, over CDP with USB debugging.

It seems possible though, to use puppeteer (a framework chrome automation and testing) in conjunct with the functinality provided to browser extensions through the history API.

I haven't tested this, but in theory, one should be able to inject extension code via the puppeteer API calls into the browser tabs. Some examples of what the history extension API can do, can be found here. The starting point would probably be the Page API to call the extension code and the BrowserContext API.

But keep in mind, it will only be possible to do these things on desktop browsers - iirc the mobile version of Chrome does not support extensions.

Let me know if you are able to find out more about it.