Get browser active tab with go

962 views
Skip to first unread message

mllb...@gmail.com

unread,
Sep 22, 2015, 5:25:12 PM9/22/15
to golang-nuts
Hey,
 I have a project that ugently needs to access browser active tab URL if it is possible somehow. I know there are some ways in C# but what about Go? First Chrome is enough, later I would like to access Firefox too

Thank you!

Giulio Iotti

unread,
Sep 23, 2015, 3:38:09 AM9/23/15
to golang-nuts, mllb...@gmail.com
On Tuesday, September 22, 2015 at 11:25:12 PM UTC+2, mllb...@gmail.com wrote:
Hey,
 I have a project that ugently needs to access browser active tab URL if it is possible somehow. I know there are some ways in C# but what about Go? First Chrome is enough, later I would like to access Firefox too

Can you point us at the C# documentation?

There might be some OS specific RPC possible with some browsers (you need to tell us which OS and Browser you target), but it's a big if.

Personally, I would be pretty annoyed if my browser leaked the open URLs to external processes so easily.

-- 
Giulio Iotti
 

mllb...@gmail.com

unread,
Sep 23, 2015, 4:07:51 AM9/23/15
to golang-nuts

mllb...@gmail.com

unread,
Sep 23, 2015, 4:07:51 AM9/23/15
to golang-nuts

Giulio Iotti

unread,
Sep 23, 2015, 4:22:31 AM9/23/15
to golang-nuts, mllb...@gmail.com
On Wednesday, September 23, 2015 at 10:07:51 AM UTC+2, mllb...@gmail.com wrote:
http://stackoverflow.com/questions/7814027/how-can-i-get-urls-of-open-pages-from-chrome-and-firefox

So this is Windows specific and doesn't work any more, according to this[1]
 
And this one is a bit different but very advanced:
 http://blog.diniscruz.com/2013/06/when-best-way-to-automate-chrome-is-to.html 

This is Javascript running in the browser and can be done easily. You can serve a page to the browser (open it with this package[2]), that asks for permissions and POSTs back the list of tabs, like here[3], using an extension (Chrome only.) A browser extension is probably the most sane way to do this.

As I said, there is no easy way for good reasons. Why do you need this list?
 
-- 
Giulio Iotti 

mllb...@gmail.com

unread,
Sep 23, 2015, 4:27:08 AM9/23/15
to golang-nuts
Hey,
I made a chrome extension that Google did not accept because of an iframe calling my website. It does not contain anything malware etc. But they did not accept. So I would like to tackle it and open it not in the browser but on the computer. (its a sidebar). But I need the active URL for this. I dont need the webpage content, I dont need any user data, only the current url.

Best Regards,
Laszlo
Reply all
Reply to author
Forward
0 new messages