Access to the DOM of the active tab from the extension

67 views
Skip to first unread message

Александр Белков

unread,
Sep 6, 2021, 5:04:24 AM9/6/21
to brython
Greetings to all! Please do not judge strictly, I write with the help of a Yandex translator. I would like to learn how to create extensions for Google chrome using brython. In particular, the following question arises: how to access the DOM of an active tab from an extension? Tell me in which direction to drip, and if someone gives a ready-made solution, thank you in advance. Only preferably with explanations, I would like to understand what I am writing.

Kiko

unread,
Sep 6, 2021, 8:59:27 AM9/6/21
to bry...@googlegroups.com
2021-09-06 11:04 GMT+02:00, Александр Белков <aleks...@gmail.com>:
> Greetings to all! Please do not judge strictly, I write with the help of a
> Yandex translator. I would like to learn how to create extensions for
> Google chrome using brython. *In particular, the following question arises:
>
> how to access the DOM of an active tab from an extension?* Tell me in which
>
> direction to drip, and if someone gives a ready-made solution, thank you in
>
> advance. Only preferably with explanations, I would like to understand what
>
> I am writing.
>
> --
> You received this message because you are subscribed to the Google Groups
> "brython" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to brython+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/brython/13240469-bf3b-44dc-a73f-a17a1bbf7e91n%40googlegroups.com.
>

Kiko

unread,
Sep 6, 2021, 9:04:00 AM9/6/21
to bry...@googlegroups.com
Hi, have a look here:
https://github.com/brython-dev/brython/issues/593#issuecomment-355861846
https://github.com/imvickykumar999/Chrome-Extension

You have a links to proofs of concept of using brython in a chrome
extension. About specific permissions of the extension, I think this
is more related with how the extension works than to brython.

Edward Elliott

unread,
Sep 6, 2021, 4:04:47 PM9/6/21
to brython
Interesting, I didn't know others were working on this.  I made some chrome extensions in brython too - in fact it's why I got into brython.

I haven't gotten around to organizing my code and putting it on github yet.  However I did post example code to brython once.  Issue #1375 has a zip file attached with a minimal brython extension and instructions to launch.  It's got the basic elements to get a brython extension running.

From there, most of the work is figuring out the DOM, the chrome extension APIs, and how to interface with them.  Some things can be a bit tricky, but it all works eventually.

I don't have any more general advice at the moment.  Feel free to post any specific issues or questions here and I'll answer if I can.

Edward
Reply all
Reply to author
Forward
0 new messages