[英]Manipulation DOM with Chrome Extension
在帶有擴展功能的Chrome擴展程序中,我想打開一定數量的標簽,並且在加載后要使用變量來操作DOM。
我可以打開選項卡,但是找不到將數據發送到選項卡的方法。
也許更好的方法是使用POST方法打開Url並直接發送數據?
popup.js
$(document).ready(function () {
"use strict";
$('button').on('click', function () {
chrome.tabs.create({ windowId: window.id, url: "http://www.url1.com" }
// manipulate the dom/form data with 2 variables, which are given
// var1 = xxx and var2 = yyy
chrome.tabs.create({ windowId: window.id, url: "http://www.url2.com" }
// manipulate the dom/form data with 2 variables, which are given
// var3 = 123 and var4 = 678
});
});
請使用postMessage CHROME API在以下任何腳本之間發送或接收數據。
有關詳細信息,請參考以下文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.