Why doesn htdig follow links to other pages in JavaScript code?
There probably isn’t any indexing tool in existance that follows JavaScript links, because they don’t know how to initiate JavaScript events. Realistically, it would take a full JavaScript parser in order to be able to figure out all the possible URLs that the code could generate, something that’s way beyond the means of any search engine.