Reputation: 38190
I can request an html page with Fetch API, but I just need the title, is it possible to request partial html page (the beginning) ?
Upvotes: 2
Views: 611
Reputation: 370789
The title of a page exists in the HTML markup. For this page, it's:
<head>
<title>javascript - Fetch API : is it possible to request partial html page (the beginning) - Stack Overflow</title>
So you will need to at least make an initial request for the whole page response.
If you want to try to stop parsing the response as soon as the first chunk (which will likely contain the <title>
) comes in, you could use a readable stream and close and/or use an AbortController
.
Upvotes: 2