I'm using ajax to load html document on the web (to extract data automatically), like so:
$.ajax({
url:'http://example.com/index.php',
crossDomain: true,
accepts:"html",
dataType:"html"});
I expect it to load the html document only. However all images attached to the document are loaded too. By inspecting browser's network activity via developer console, I can see that images are being request along.
Example of returned html document.
<html>
<body>
<div>Data I wanted: item price, stock availability etc.</div>
<img src="../img/very-large-image.jpg" />
</body>
</html>
Browser is making request for '../img/very-large-image.jpg' after receiving the html doc.
Is there a way to load HTML doc without the browser making request for the image? I would like to load html only. This issue affect my app performance especially when images on that page is large in size.
I have tried searching the internet for answers but haven't found any related articles yet. I would appreciate your help.