该项目可以让你用Go语言来编写Chrome扩展,示例代码:
package mainimport ( "strconv" "honnef.co/go/js/dom" "github.com/fabioberger/chrome")func main() { c := chrome.NewChrome() tabDetails := chrome.Object{ "active": false, } c.Tabs.Create(tabDetails, func(tab chrome.Tab) { notification := "Tab with id: " + strconv.Itoa(tab.Id) + " created!" dom.GetWindow().Document().GetElementByID("notification").SetInnerHTML(notification) })}点击空白处退出提示
评论