Prevent images from loading on non-DOM jQuery AJAX parse

前端 未结 3 1817
闹比i
闹比i 2020-12-05 20:26

I\'m using jQuery ajax request to grab and parse HTML on a secondary page.. Looking at the Network panel of both Chrome and FF, I noticed that it will load the images from t

3条回答
  •  悲&欢浪女
    2020-12-05 21:09

    You can find and delete all the image tags from the returned string before loading it to your DOM.

    This is the regex for HTML images:

    <[iI][mM][gG][a-zA-Z0-9\s=".]*((src)=\s*(?:"([^"]*)"|'[^']*'))[a-zA-Z0-9\s=".]*/*>(?:)*
    

提交回复
热议问题