Chrome Extension: DOM traversal

前端 未结 3 1106
天命终不由人
天命终不由人 2021-02-04 22:36

I want to write a Chrome extension that looks at the HTML of the page its on, and if it finds eg

then it will output, as a HTML list in the
3条回答
  •  天涯浪人
    2021-02-04 23:05

    Unless the problem is more complex than I think, why not just use jQuery or other convenient js api for this? This is what they were made for - to traverse the dom easily. You can inject jquery and your script that will be using it into required pages in manifest:

    "content_scripts": [ {
        "js": [ "jquery.js", "script.js" ],
        "matches": [ "http://*/*", "https://*/*" ]
    }]
    

提交回复
热议问题