2022-06-23

Find all JS classes used in web page [duplicate]

Is there a way to find every unique class definition used in a WebPage? For example, if a web page has three unrelated JS classes Dog, Cat, and Mouse, but I do not know that these classes exist, how would I discover them?

//returns all the JS classes in a document
function getAllDocumentClasses(){

}

This would be a function I would run in the chrome console.

Context: I'm preparing some documentation on extracting data from web pages using javascript. One approach to do this is to investigate the classes used in a library, for example, to see all the instances of a Highcharts and then extract the data used in that Highcharts instances. But if we do not know which libraries a web page is using, then this is more difficult.

Edit: Seems like this might not be possible with javascript. But if you go to Chrome Developer Tools and type window., then you can browse through available classes in the window.

window



No comments:

Post a Comment