Forked from lelinhtinh/Stop auto load imges when parseHTML in jQuery
Created
August 25, 2017 00:31
-
-
Save monodyle/0fdc678d391e0173d8633a4e6171e31c 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