Need to capture click events on the active tab

164 views
Skip to first unread message

Sanjana Badam

unread,
Sep 1, 2017, 2:57:47 PM9/1/17
to Chromium-Extensions-Announce
Hi team, 
I am new to Javascript and I am writing a chrome extension for the first time. 
I have a sample extension for now which displays the active tab url. 
I want to log all the click events on the active tab and store it in a local database. 


1. Is it possible to store to a local database?
2. Can I capture click events or any events for that matter on the active tab? 
3. Also, is it possible for the chrome plug in to access the cookies in the browser? (I think yes, but please correct me if it is not possible).




Thanks,
Sanjana

PhistucK

unread,
Sep 1, 2017, 4:25:04 PM9/1/17
to Sanjana Badam, Chromium-Extensions-Announce
1. Yes, sort of. Any local storage mechanism that is offered by a web API (cookies, localStorage, sessionStorage, IndexedDB, the deprecated Web SQL Databases or the deprecated FileSystem API) or a Chrome extension API (chrome.storage) is available to extensions. They will not be stored as normal files on the machine of the user, but in very specific files/databases within the profile directory of the user, usually without any human readable names. But, yes, local nonetheless.

2. Yes. Once you manage to figure out how to do that in normal JavaScript/web APIs, coding it using extensions is very similar (they use JavaScript, after all).

3. Yes. The chrome.cookies API lets you access and manipulate cookies.


PhistucK

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/0a753013-1283-4296-a4e5-8ba55ccf4549%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Sanjana Badam

unread,
Sep 1, 2017, 9:12:04 PM9/1/17
to Chromium-Extensions-Announce, sanjan...@gmail.com
Hi,
Thank you for your reply.

I was looking into 2. When I was trying to get the elements I was getting it from popup.html (extension one) and not the active tab. I tried using "chrome.tabs.executeScript". Is there something I missed in that? 


On Friday, September 1, 2017 at 1:25:04 PM UTC-7, PhistucK wrote:
1. Yes, sort of. Any local storage mechanism that is offered by a web API (cookies, localStorage, sessionStorage, IndexedDB, the deprecated Web SQL Databases or the deprecated FileSystem API) or a Chrome extension API (chrome.storage) is available to extensions. They will not be stored as normal files on the machine of the user, but in very specific files/databases within the profile directory of the user, usually without any human readable names. But, yes, local nonetheless.

2. Yes. Once you manage to figure out how to do that in normal JavaScript/web APIs, coding it using extensions is very similar (they use JavaScript, after all).

3. Yes. The chrome.cookies API lets you access and manipulate cookies.


PhistucK

On Fri, Sep 1, 2017 at 9:57 PM, Sanjana Badam <sanjan...@gmail.com> wrote:
Hi team, 
I am new to Javascript and I am writing a chrome extension for the first time. 
I have a sample extension for now which displays the active tab url. 
I want to log all the click events on the active tab and store it in a local database. 


1. Is it possible to store to a local database?
2. Can I capture click events or any events for that matter on the active tab? 
3. Also, is it possible for the chrome plug in to access the cookies in the browser? (I think yes, but please correct me if it is not possible).




Thanks,
Sanjana

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.

PhistucK

unread,
Sep 2, 2017, 4:03:47 PM9/2/17
to Sanjana Badam, Chromium-Extensions-Announce
executeScript is a good way to run scripts in a tab, yep.
Since you cannot access the content of the tab directly, you have to pass a message from the executed script in the tab to the popup page, using chrome.runtime.sendMessage and the like.
See message passing for more information.


PhistucK

On Sat, Sep 2, 2017 at 4:12 AM, Sanjana Badam <sanjan...@gmail.com> wrote:
Hi,
Thank you for your reply.

I was looking into 2. When I was trying to get the elements I was getting it from popup.html (extension one) and not the active tab. I tried using "chrome.tabs.executeScript". Is there something I missed in that? 


On Friday, September 1, 2017 at 1:25:04 PM UTC-7, PhistucK wrote:
1. Yes, sort of. Any local storage mechanism that is offered by a web API (cookies, localStorage, sessionStorage, IndexedDB, the deprecated Web SQL Databases or the deprecated FileSystem API) or a Chrome extension API (chrome.storage) is available to extensions. They will not be stored as normal files on the machine of the user, but in very specific files/databases within the profile directory of the user, usually without any human readable names. But, yes, local nonetheless.

2. Yes. Once you manage to figure out how to do that in normal JavaScript/web APIs, coding it using extensions is very similar (they use JavaScript, after all).

3. Yes. The chrome.cookies API lets you access and manipulate cookies.


PhistucK

On Fri, Sep 1, 2017 at 9:57 PM, Sanjana Badam <sanjan...@gmail.com> wrote:
Hi team, 
I am new to Javascript and I am writing a chrome extension for the first time. 
I have a sample extension for now which displays the active tab url. 
I want to log all the click events on the active tab and store it in a local database. 


1. Is it possible to store to a local database?
2. Can I capture click events or any events for that matter on the active tab? 
3. Also, is it possible for the chrome plug in to access the cookies in the browser? (I think yes, but please correct me if it is not possible).




Thanks,
Sanjana

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsubscribe...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsubscribe...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
Reply all
Reply to author
Forward
0 new messages