Answer the question
In order to leave comments, you need to log in
How to access a particular tab from the Google chrome extension?
Good day.
I'm starting to figure out how to create an extension for chrome and I can't understand the following things:
1. How can I access the location parameter of the browser page itself from the extension itself?
2. How to catch the moment of loading the site itself?
3. How to display a message when the site is loaded? (i.e. a person comes to the ya.ru site, and a message pops up saying that "And there is everything on Yandex" or "Greetings to you, great applicant")
4. What scripts do you need connect to manifest.json and how to do it correctly so that the extension works when the browser starts?
At the moment there is this:
manifest.json:
{
"manifest_version": 2,
"name": "Test",
"version": "1.0",
"icons": {
"128": "128.png"
},
"background": {
"scripts": ["background.js","jquery.js"]
},
"permissions": [
"cookies",
"tabs"
],
"browser_action": {
"default_title": "Test",
"default_icon": "128.png",
"default_popup": "popup.html"
}
}
$(document).ready(function () {
jsonUpload();
});
function jsonUpload() {
if (localStorage['date_json'] == undefined) {
localStorage['date_json'] = new Date().getTime();
}
if (localStorage['json'] == undefined) {
jsonLoad()
}
tempDate = new Date().getTime();
var delta = tempDate - localStorage['date_json'];
if (delta > 3600000) {
localStorage['date_json'] = new Date().getTime();
jsonLoad()
}
setTimeout(jsonUpload, 10000);
}
function jsonLoad() {
$.getJSON("/*тут какая нибудь API*/",function(data){
localStorage['json'] = data;
});
}
function checkUrl() {
var array=JSON.parse(localStorage['json']);
array.forEach(function(item, i, data) {
// if (item['domen']==chrome)
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question