/**
* 替换img标签src属性
* @param content
* @param path
*/
function img***c(content, path) {
var imgreg = //gi;
content=content.replace(imgreg,function(imgsrc){
imgsrc = imgsrc.replace(/src=(?:"\s*([^"]*)\s*"|'\s*([^']*)\s*'|(\S+))/i,"src=\""+path+"$1\"");
return imgsrc;
});
//不是微信内核浏览器
if(!is_weixin()) {
content = content.replace(/(]*?src=['""]([^'""]*?)['""][^>]*?>)/g, '$1');
}
return content;
}
/**
* 判断微信内核浏览器
* @returns {Boolean}
*/
function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == "micromessenger") {
return true;
} else {
return false;
}
}