I want to parse a string which contains HTML text. I want to do it in JavaScript.

I tried the Pure JavaScript HTML Parser library but it seems that it parses the HTML of my current page, not from a string. Because when I try the code below, it changes the title of my page:

var parser = new HTMLtoDOM("<html><head><title>titleTest</title></head><body><a href="https://stackoverflow.com/questions/10585029/test0">test01</a><a href="test1">test02</a><a href="test2">test03</a></body></html>", document);

My goal is to extract links from an HTML external page that I read just like a string.

Do you know an API to do it?

14 Answers
14

Leave a Reply

Your email address will not be published. Required fields are marked *