рдПрдХ рдмрд╛рд░, рдореБрдЭреЗ Google Chrome рдХреЗ рддрд╣рдд рдПрдХ рдмреНрд░рд╛рдЙрдЬрд╝рд░-рдЖрдзрд╛рд░рд┐рдд рдЦрд┐рд▓реМрдиреЗ рдХреЗ рд▓рд┐рдП рдПрдХреНрд╕рдЯреЗрдВрд╢рди рд▓рд┐рдЦрдиреЗ рдХреЗ рдХрд╛рд░реНрдп рдХрд╛ рд╕рд╛рдордирд╛ рдХрд░рдирд╛ рдкрдбрд╝рд╛ред
рд╡рд┐рд╕реНрддрд╛рд░ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдкреЗрдЬ рдХреЗ рдЬрд╛рд╡рд╛рд╕реНрдХреНрд░рд┐рдкреНрдЯ рд╡рд╛рддрд╛рд╡рд░рдг рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдирд╛ рдЖрд╡рд╢реНрдпрдХ рдерд╛ред рд╕рдорд╕реНрдпрд╛ рдпрд╣ рд╣реИ рдХрд┐ рд╕рд╛рдордЧреНрд░реА рд╡рд┐рд╕реНрддрд╛рд░ рд╕реНрдХреНрд░рд┐рдкреНрдЯ рд╕реЗ рдЗрд╕ рд╡рд╛рддрд╛рд╡рд░рдг рддрдХ рдкрд╣реБрдВрдЪ рд╕рдВрднрд╡ рдирд╣реАрдВ рд╣реИред
рдЦреЛрдЬ рдХрд╛рд░реНрдп рдХреЗ рдкрд░рд┐рдгрд╛рдорд╕реНрд╡рд░реВрдк, рдпрд╣ рдкрд╛рдпрд╛ рдЧрдпрд╛ рдХрд┐ рдЗрд╕ рд╕рдорд╕реНрдпрд╛ рдХрд╛ рдХреЛрдИ рд╕рдлрд▓ рд╕рдорд╛рдзрд╛рди рдирд╣реАрдВ рдерд╛, рдЗрд╕рд▓рд┐рдП, рдЙрдкрд▓рдмреНрдз рд╕рд╛рдордЧреНрд░реА рдХрд╛ рдЕрдзреНрдпрдпрди рдХрд░рддреЗ рд╣реБрдП, рдПрдХ рд╕рд░рд▓ рдкреНрд░рдгрд╛рд▓реА рдмрдирд╛рдИ рдЧрдИ рдереА рдЬреЛ рдЖрдкрдХреЛ рд╡рд┐рдХрд╛рд╕ рдкреНрд░рдХреНрд░рд┐рдпрд╛ рдХреЗ рджреМрд░рд╛рди рдЕрддрд┐рд░рд┐рдХреНрдд рдкреАрдбрд╝рд╛ рдХреЗ рдмрд┐рдирд╛, рдХрд┐рд╕реА рднреА рдХреЛрдб рдХреЛ рд╕реАрдзреЗ рдкреГрд╖реНрда рдореЗрдВ рдПрдореНрдмреЗрдб рдХрд░рдиреЗ рдХреА рдЕрдиреБрдорддрд┐ рджреЗрддреА рд╣реИред рдЖрдЧреЗ, рдореИрдВ рдПрдХ рд╡рд┐рд╕реНрддрд╛рд░ рдХрд╛ рдПрдХ рд╕рд░рд▓ рдЙрджрд╛рд╣рд░рдг рдкреНрд░рд╕реНрддреБрдд рдХрд░реВрдВрдЧрд╛ рдЬреЛ рдЗрд╕ рд╕рдорд╕реНрдпрд╛ рдХреЛ рд╣рд▓ рдХрд░рддрд╛ рд╣реИред
рдпрд╣ рд╡рд┐рдЪрд╛рд░ рд╕реНрдХреНрд░рд┐рдкреНрдЯ рдлрд╝рд╛рдЗрд▓ рдХреА рд╕рд╛рдордЧреНрд░реА рдХреЛ рд╕реАрдзреЗ рдЯреИрдЧ рдкрд░ рдХреЙрдкреА рдХрд░рдиреЗ рдкрд░ рдЖрдзрд╛рд░рд┐рдд рд╣реИ
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
-
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
-
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
-
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
-
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .
. , , .
:
manifest.json - background.js - content script, injected.js - jquery.js - ajax. jquery.com
:
manifest.json
{ "name": "JS Code Injection", "version": "1.0", "manifest_version": 2, "content_scripts": [ { "matches": [ "http://extension.target.url" ], "js": [ "jquery.js", "background.js" ], "run_at": "document_end" } ], "web_accessible_resources": [ "/injected.js" ] }
manifest- .
, injected.js web_accessible_resources, content-.
injected.js
function injected_main() { alert('Injected!'); }
, . javascript , .
background.js
$.get(chrome.extension.getURL('/injected.js'), function(data) { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.innerHTML = data; document.getElementsByTagName("head")[0].appendChild(script); document.getElementsByTagName("body")[0].setAttribute("onLoad", "injected_main();"); } );
Chrome Extension API chrome.extension.getURL()
, , . ajax ( Shared DOM ) , ( injected_main()
injected.js)
. ( ), - . - injected.js .