I have tried searching on Google and also read the documentation but no success. I am making the ajax request in contentScript (chrome extension) or otherwise known as greasemonkey script for firefox users.
A typical function to get a URL using AJAX,
function getURL(url, element)
{
var request = new XMLHttpRequest();
request.onreadystatechange = function()
{
if ( request.readyState == 4 )
{
callback( request.responseText, element, request.status );
}
};
request.open( "GET", url, true );
request.send()
}
Lets say I only need first 10kb of the page but the whole size of page is more than 200kb
. The page I am retrieving is a normal HTML. I don't want to waste the bandwidth by downloading the excess 190kb
. Is there any way to achieve that? Also, if retrieving only a part of page from 100kb to 110kb possible?
I am open for browser specific solution (chrome). And I have to port the extension to Firefox too so ideas about that is also welcome.