rich-text不能解析link标签?
发布于 8 年前 作者 yongsong 3789 次浏览 来自 问答

京东返回的富文本用的是背景图片,利用link标签引入的外部css,由于rich-text不能解析link标签,所以尝试把css文件下载到本地,然后用正则把所有的url地址全部保存下来。可是这样做计算量太大了,小程序直接卡死,相当于是写了一个死循环。请问有没有解决办法?

<html lang=“zh”><head><meta charset=“utf-8”><title>商品详情</title><meta name=“viewport” id=“viewport” content=“width=device-width”><script type=“text/javascript”>(function () {document.getElementById(“viewport”).setAttribute(“content”,“width=device-width,initial-scale=”+document.documentElement.clientWidth/760+",user-scalable=no")}());</script></head><body><div cssurl=’//sku-market-gw.jd.com/css/pc/7264969.css?t=1567578932365’></div><div id=‘zbViewModulesH’ value=‘5379’></div><input id=‘zbViewModulesHeight’ type=‘hidden’ value=‘5379’/><div skudesign=“100010”></div><div class=“ssd-module-wrap” >↵ <div class=“ssd-module M15308600460261 animate-M15308600460261” data-id=“M15308600460261”>↵ ↵</div>↵<div class=“ssd-module M15308600460452 animate-M15308600460452” data-id=“M15308600460452”>↵ ↵</div>↵<div class=“ssd-module M15308600461215 animate-M15308600461215” data-id=“M15308600461215”>↵ ↵</div>↵<div class=“ssd-module M15554882382801 animate-M15554882382801” data-id=“M15554882382801”>↵ ↵</div>↵<div class=“ssd-module M15308600461546 animate-M15308600461546” data-id=“M15308600461546”>↵ ↵</div>↵<div class=“ssd-module M15308600461857 animate-M15308600461857” data-id=“M15308600461857”>↵ ↵</div>↵↵</div>↵<!-- 2019-04-17 04:03:59 --> ↵<link rel=‘stylesheet’ type=‘text/css’ href=’//sku-market-gw.jd.com/css/pc/7264969.css?t=1575409800071’ media=‘all’ /></body></html>

上面是京东返回的一段代码,样式全部依赖于最后的link标签中引入的css文件

回到顶部