hibichan
hibichan
PD🧩 Plasmo Developers
Created by hibichan on 7/17/2024 in #🔰newbie
I wanna make a button to change some on current page
thanks very much! im going to do
14 replies
PD🧩 Plasmo Developers
Created by hibichan on 7/17/2024 in #🔰newbie
I wanna make a button to change some on current page
func: new Function(script) doesnt work
14 replies
PD🧩 Plasmo Developers
Created by hibichan on 7/17/2024 in #🔰newbie
I wanna make a button to change some on current page
button in popup:
const executeScript = (script: string) => { chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { const activeTab = tabs[0]; if (activeTab?.id !== undefined) { chrome.runtime.sendMessage({ action: "executeScript", tabId: activeTab.id, script }); } }); };
14 replies
PD🧩 Plasmo Developers
Created by hibichan on 7/17/2024 in #🔰newbie
I wanna make a button to change some on current page
background: chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { if (request.action === "executeScript") { const { script, tabId } = request chrome.scripting.executeScript({ target: { tabId: tabId }, func: function (code) { eval(code) }, args: [script] }) } })
14 replies
PD🧩 Plasmo Developers
Created by hibichan on 7/17/2024 in #🔰newbie
I wanna make a button to change some on current page
My English is bad, hope I can express what I mean
14 replies
PD🧩 Plasmo Developers
Created by hibichan on 7/17/2024 in #🔰newbie
I wanna make a button to change some on current page
i wanna run a js snippet which is store in storageAPI, but if i use chrome.runtime.sendMessage at Popup.tsx and chrome.runtime.onMessage at background.ts, it would told me unsafe-eval and dont run it。Do I have any other better solution? Besides allowing unsafe-eval
14 replies