Reputation: 2236
Is there a way to request only the head portion of an HTML page without needing to download the complete webpage? I am only interested meta tags like description, keywords and title (tag).
To generalize are there any HTTP methods that I could use to only request specific tags from a server without needing to download the whole webpage ?
Please let me know.
Upvotes: 4
Views: 1830
Reputation: 943569
No.
The closest HTTP has is the Range header which lets you request specific bytes from servers which support it.
The problem is that you can't reliably know how many bytes the head section of the document will take up before you request it.
Upvotes: 5
Reputation: 151594
The things you're looking for are defined at the HTML level, a couple of layers above the HTTP layer. So no, there's no foolproof way to only request certain tags from an HTML page.
Given those tags are bound to be present in the <head>
section of the page, you can stop reading the response after you encountered the </head>
tag though - if the HTML is well-formed.
Upvotes: 6