我通过内容脚本获取网址,并尝试通过sendMessage将其传递到我的后台页面,但收到SELECT r.totalqty,
f.profit,
p.mymonth,
c.title
FROM (SELECT invoiceid,Sum(qty) totalqty,product_category_id
FROM sold_items
GROUP BY sold_items.product_category_id) AS r
LEFT JOIN (SELECT invoiceid,Sum(profit) profit FROM profit_table GROUP BY profit_table.invoiceid) AS f ON r.tid = f.tid
LEFT JOIN (SELECT tid,DATE(tdate) mymonth FROM pstatements) AS p
ON r.invoiceid = p.invoiceid
LEFT JOIN (SELECT id,title FROM product_category) AS c
ON r.product_category_id = c.id
WHERE YEAR(p.mymonth)='2017' GROUP BY DATE(p.tdate)
。
内容脚本:
[object Object]
后台脚本:
var kom = document.querySelectorAll("a[href*='permalink']");
var linkX = kom[0];
chrome.runtime.sendMessage(
{
link: linkX
});
我发现你无法通过消息传递DOM节点,数据必须是JSON可序列化的。
如何发送我的网址?
答案 0 :(得分:0)
怎么样
chrome.runtime.sendMessage(
{
link: linkX.href
});
答案 1 :(得分:0)
你可以试试这个..
chrome.runtime.sendMessage({
link: linkX.href
});