@w0s/closest-html-page
v3.0.0
Published
Get the data of the HTML page of the nearest ancestor hierarchy
Downloads
13
Readme
Get the data of the HTML page of the nearest ancestor hierarchy
Demo
Examples
<script type="importmap">
{
"imports": {
"@w0s/closest-html-page": "...",
"whatwg-mimetype": "..."
}
}
</script>
<script type="module">
import ClosestHTMLPage from '@w0s/closest-html-page';
const closestHTMLPage = new ClosestHTMLPage({
maxFetchCount: 3,
fetchOptions: {
redirect: 'error',
},
mimeTypes: ['text/html'],
});
await closestHTMLPage.fetch('https://example.com/path/to/file');
const url = closestHTMLPage.getUrl();
const title = closestHTMLPage.getTitle();
</script>
Constructor
new ClosestHTMLPage(options?: Option)
Parameters
Option
interface Option {
maxFetchCount?: number;
fetchOptions?: RequestInit;
mimeTypes?: DOMParserSupportedType[];
}