Created
June 6, 2016 13:48
-
-
Save lelinhtinh/888ddf3ab3de911af1aa5500b22320d1 to your computer and use it in GitHub Desktop.
Chặn tải ảnh khi dùng parseHTML trong jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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