Is there any way to get remote JS file to chrome extension?
My manifest.json looks like this:
{
"name": "My Extension",
"version": "0.1",
"content_scripts": [
{
"matches": ["http://*/*"],
"js": ["jquery.js", "main.js"],
"run_at": "document_end",
"all_frames": true
}
]
}
I want use one JavaScript API, which is limited by usage on selected domain, so I can't insert it simply to loaded page in Chrome like this:
$('head').append('<script src="http://example.com/myApi.js?key=%key%"></script>');
because the JS API alerted me, that I'm using it on URL, which I haven't gave them.
I want just use some functions from this remote JS. The API key can be fortunately registered and used on localhost.
But I don't have any clue, how to solve this problem - where to put the remote JS file to be able to use it.
I've got an idea to create a "virtual DOM", but perhaps it's not a solution, because the JS API code can't be executed.
Where to insert the code? Some background page??