diff --git a/src/content.js b/src/content.js index 67b1407..da96953 100644 --- a/src/content.js +++ b/src/content.js @@ -6,12 +6,12 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => { sendResponse(window.location.href); break; - case 'getBody': - sendResponse(document.body.innerHTML); + case 'getDOM': + sendResponse(document.getElementsByTagName('html')[0].outerHTML); break; - case 'setBody': - document.body.innerHTML = message.html; + case 'setDOM': + document.getElementsByTagName('html')[0].innerHTML = message.html; break; } }); diff --git a/src/utils.js b/src/utils.js index 0a0605c..f53e397 100644 --- a/src/utils.js +++ b/src/utils.js @@ -35,14 +35,14 @@ export default { return await browser.tabs.sendMessage(tab.id, { type: 'getURL' }); }, - async getBody() { + async getDOM() { const tab = await this.getCurrentTab(); - return await browser.tabs.sendMessage(tab.id, { type: 'getBody' }); + return await browser.tabs.sendMessage(tab.id, { type: 'getDOM' }); }, - async setBody(html) { + async setDOM(html) { const tab = await this.getCurrentTab(); - await browser.tabs.sendMessage(tab.id, { type: 'setBody', html: html }); + await browser.tabs.sendMessage(tab.id, { type: 'setDOM', html: html }); }, async run(action, host) {