1

I'm looking to create a chrome extension to modify the Gmail of users. Something similar to the rapportive extension.

I already tried to develop a google gadget, but i want to set a right menu context (as rapportive), i also tried the raplets solution and it's not what i want.

I tried to find documentation with google, but i didn't found something to modify Gmail. Can you help me to start.

1 Answer 1

2

Rapportive was able to add UI in GMail by manipulating Gmail's DOM.

The idea is that:

  • when it recognise that GMail is inside a email thread (see Gmailjs's gmail.observe method)

  • it then inserts its own UI by directly manipulating the DOM.

  • then load social data based on the details of the current thread

These libraries will help you in reading the current state of GMail (eg. which page is it currently on, all people involved in an email etc)

Gmailr: https://github.com/jamesyu/gmailr

Gmailjs: https://github.com/KartikTalwar/gmail.js

to manipulate the GMail's DOM, you can always use jQuery or leverage chrome's native methods in manipulating the DOM since you wont to worry about cross browser inconsistencies

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, your sources were very useful for me. I just miss one thing. How to display in the right menu (still as rapportive) my datas.
updated my answer on how an extension like Rapportive can modify Gmail's UI
Thanks for your sources which helped me a lot. i'm just wondering something. I have my extension working fine but sometimes it doesn't appear in Gmail. It's totally random without any logical. But i have my console.log displayed so i guess it's just the DOM injection which failed. I catch the part of the Gmail site where i want to set my widget, wait the 'document_end' (specified in my manifest.json) then inject it and then process the thing i want to do. But why it doesn't work everytime ?
Gmail is a "Single Page Application". 'document_end' is triggered even if gmail is still loading state, which might be the case when its failing for you since the elements you're trying to inject into is not yet there. You have to find a way to know when gmail has finished loading and have already rendered the actual app, that's the time you would want to do the injection.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.