I want to create an extension for chrome that is near to the GmailChecker. I've seen its source code but hek, it's a bit complex. It seem to use some AJAX.
I've try to use jQuery, but it doesen't work in this case (can't access to website hosted on an other server... and as this is an extension for chrome, the script can't be executed from the same server).
By the way I'm not sure what I want to do is possible with it. I don't really know chrome extension well yet, so I need your help.
I want to proceed like that : In the background page, at regular intervals, load a page using cookies-session (for browsing into a website with login system). Then getting the source code of the loaded page, and doing some stuff then (like said to the user if he has message, but meh, this is not the topic nor the problem I think).
So I need at least :
- Make queries with cookies and session
- Access to the source code of web-hosted page
- Doing all of this thing in the background page (hidden and separated of the user's browsing).
Can I do this things with an Chrome Extension (and if yes, can you give me some function or tip to do it) ?
Thank you !!
Manifest :
{
"manifest_version": 2,
"name": "My Extension",
"version": "1",
"description": "Yeah, cool ext",
"browser_action": {
"default_popup": "file.html"
},
"permissions": ["tabs",
"background",
"*://*.google.com/"],
"background": {
"page": "background.html"
}
}
background.html :
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src='script.js'></script>
</body>
</html>
script.js :
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
console.log(xhr.responseText); //that's the source code
};
xhr.open("GET", "http://www.google.com", true);
xhr.send();