Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lelinhtinh/888ddf3ab3de911af1aa5500b22320d1 to your computer and use it in GitHub Desktop.
Save lelinhtinh/888ddf3ab3de911af1aa5500b22320d1 to your computer and use it in GitHub Desktop.
Chặn tải ảnh khi dùng parseHTML trong jQuery
// http://stackoverflow.com/a/15217348
$.get(URL).done(function (responseText) {
responseText = responseText.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match, capture) {
return '<img data-src="' + capture + '" />';
});
console.log($(responseText).find('img'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment