开发者

How to parse HTML to DOM in chrome extension

开发者 https://www.devze.com 2023-04-08 00:18 出处:网络
I am building a Chrome Extension, that I will scan many pages of different domains in background and examine whether there are some text patterns in the pages.

I am building a Chrome Extension, that I will scan many pages of different domains in background and examine whether there are some text patterns in the pages.

I can use regex to search the plain HTML text, but I prefer to parse the HTML text into DOM and then trav开发者_JS百科erse the DOM.

My question is, how can I get the DOM in a Chrome Extension ?

Thanks!


You can get it with jquery:

var html = "<html>...</html>";
var el = $(html).find(".class");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号