background.js
var s = document.createElement("script"); s.src=chrome.extension.getURL("injected.js"); document.getElementsByTagName("html")[0].appendChild(s); window.addEventListener("message", function(event) { // получаю отправленные данные из инъекции if (event.source != window) return; if (event.data.type && (event.data.type == "myData")) { console.log("Content script received message: " + event.data); console.log(JSON.stringify(event.data)); } }); injected.js
function injected_main() { myHTML = document.getElementsByTagName("html")[0].innerHTML; ... разбираю нужные мне данные... window.postMessage(myData, "*"); // отправляю нужные данные в background.js } The above works as it should. But then the skis do not go ...
And now the question: how do I get this data on my server?
The first thing you encounter is not forming an ajax request in the direction of my web server to my php'shku. He does not like the fact that https on http form.
Next question: if you transfer your domain to https, will it not tell me that sending to another domain will fail? (by their security policies)
Vuminous people, tell me the way!