When archiving web pages, dynamic content has to be treated differently. How do I detect whether a page uses any JavaScript?
This will end up in a browser extension, so it probably doesn't need to exclude itself from the findings.
Simply checking for <script>
tags should be fine.
if (document.querySelectorAll("script").length) {
//there are scripts on this page
}
You could scan the entire page for onclick
, etc handlers in HTML tags, but that would be slow for a big page.