- Introduced a new script (inject.js) to override the fetch and XMLHttpRequest methods to capture requests to the "getgeoidx" endpoint. - Captured request body and URL, and sent the data to the extension via postMessage. - Added intercept.js to inject the new script into the page and listen for messages to forward captured data to the extension.
12 lines
390 B
JavaScript
12 lines
390 B
JavaScript
// inject into page
|
|
const s = document.createElement("script");
|
|
s.src = chrome.runtime.getURL("js/inject.js");
|
|
(document.head||document.documentElement).appendChild(s);
|
|
|
|
// listen for page→extension
|
|
window.addEventListener("message", e => {
|
|
if (e.source === window && e.data?.type === "ZMS_CAPTURE") {
|
|
chrome.runtime.sendMessage({ command: "CAPTURED", data: e.data.body });
|
|
}
|
|
});
|