I have Script.js file which added to the youtube page dynamically through this code:
var s = document.createElement('script');
s.src = chrome.extension.getURL('Script.js');
(document.head || document.documentElement).appendChild(s);
s.onload = function () {
s.parentNode.removeChild(s);
};
I have two questions :
1- how I can send a message from inserted file to a parent chrome extension.
2- how I can make a cross-origin request from the inserted file..It's display error message in the console
Origin http://www.youtube.com is not allowed by Access-Control-Allow-Origin.