I’m writing a Chrome extension for Gmail. I want to replace the default list view with a custom made one.
I want to fetch all message bodies for all displayed messages. How can I do so from within a Chrome extension?
Gmail has ATOM feed of unread messages. It doesn’t have a feed for all messages.
Gmail has a gmonkey object. 1.0 version is documented. There is also undocumented 2.0 version. None of them allow me to fetch a message body.
Gmail for iPad stores all messages in WebSQL storage. Unfortunately, desktop Gmail does not.
If you don't get any other answers, you can always do it the hard way, via Content Scripts, basically by injecting jQuery, scraping message bodies, readjusting DOM structures, etc.
Related
In my content script, it's looking for certain keywords in the webpages title. If they are found, I want it to display a notification, using Google's notification API. However, you can't use google's notification API in the content.js - apparently it needs to be in a background file. Any idea how I do this?
The Chrome browser supports multiple users (personas), so we can load a web page with different cookies and session data. This is working great, doing what I want. Now I wish for an extension installed on multiple user accounts to share information between users.
I cannot see how to do this, help please?
Details and Ideas:
By setting some cookies I can change some preferences of the target web page, to use some new features. Some features are different, but the core information should be the same. I wish to compare them via extension code.
By using the people feature of the chrome browser, ( personas ) I can load both old and new versions of our web page in chrome, and compare side by side.
I also have a chrome extension which scrapes a target web page, to pull out information like names, prices, information. This is also working great. I can manually check the scrape results of old or new versions of the page.
Now for the challenge : How can I compare scrape results between web pages loaded on different people (personas). Each "people" has the extension installed and running.
When I send an external message using the extension ID, only extensions on the same "people" receive it.
When I look at the background pages for each "people" extension, they are different. Setting a value for my Extension in one does not affect my Extension in the other.
// code in background page.
chrome.runtime.onMessageExternal.addListener(
function(request, sender, sendResponse){
console.log('background page was hit');
});
// paste code in browser console.
chrome.runtime.sendMessage('id_here', {getTargetData: true},
function(response) {
console.log(response);
});
You can't share data between users on the client. This would allow your extension to potentially download all of a user's data and share it with another user.
That said, you can just push the data to a shared server and use that to compare (using HTTP or Websockets)
When a webpage like https://poloniex.com/exchange#btc_eth is opened in the browser, we see that the browser constantly shows updated buy and sell orders. Also, in the Elements section in the chrome console, these updates are visible in the HTML tables.
Is there a way I can use a nodejs script run on my pc (so not in the browser console) to get these live html table updates from that website, without having to do a GET request every time?
If the chrome browser is able to do it, nodejs / jQuery / ajax should be able to do it as well. I tried the XMLHttpRequest nmp module but no luck yet.
It's possible they are using token authentication which means you wouldn't be able to get all the connection info you need just from their client-side code. Have you downloaded it and looked at it yet?
If you find it's not possible to call their services, there are other free products designed for webscraping. AutoHotKey is one that can open a web page and traverse its DOM. I believe it has the ability to run in the background, but don't quote me.
I'm not very familiar with browser extensions and before I begin to deeply explore them I have a few questions.
Let's say the extension injects JavaScript in the current website the user is visiting (if that's even possible). That injected JavaScript code will get, let's say the current URL for example purposes, and send it and store it on a database. Next time the user visits the same website, the user will get an extension notification informing that is the second or third or X time he or she has visited the same website.
Now that I have gave you the scenario, is the following possible? Injecting JavaScript from a browser extension to the current visiting website. If so, can I make some AJAX communication with the JavaScript and a PHP server?
Yes, you can inject stuff. See e.g. Insert code into the page context using a content script and How to inject javascript into page, from a Firefox add-on, and run it? or one of the many dupes there likely are.
You can then use whatever communication would be available between the site and a server, e.g. XHR, WebSockets, JSONP.
Please also check the policies of the Chrome Web Store and Mozilla Add-ons site regarding content/code injection and privacy rules. E.g. the Mozilla Add-ons will reject your add-on if you injected remote scripts (meaning code that is not bundled, e.g. originating from e.g. http:) and may also reject your stuff if you track users without prior explicit user consent.
I am developing an extension that fetches pages that the user is likely to access on a website. My extension uses jQuery.get() to fetch a page. This works correctly for a site like amazon.com.
But if the user logs in to gmail and I try to fetch some other pages like "account settings", I get an incomplete page. Somewhere in that page, I get the message:
"Your browser does not support Javascript or Javascript has been disabled.As your browser does not support Javascript or has Javascript disabled, we are not able to display the requested page."
Is there some way to fetch complete page in such cases?
I ended up opening a new tab and fetching the page in that tab. Then using content script, I analyze the page data. Sure this is a problem in the sense that a user will see newly opened tab. But then it is also transparent to the user.
If you are developing an extension on Firefox using Jetpack, you can use page-worker which is an invisible page and gives access to the DOM.