私有静态字符串converttoabsoluteUrls(字符串html,uri relativeLocation){
ihtmldocument2 doc = new htmldocumentClass();
doc.write(新对象[] {html});
doc.close();
foreach(doc.links中的ihtmlanchorelement锚){
ihtmlelement元素=(ihtmlelement)锚;
字符串href =(string)element.getAttribute(“ href”,2);
if(href!= null){
uri addr = new Uri(relativeLocation,href);
Anchor.href = addr.absoluteuri;
}
}
foreach(doc.images中的ihtmlimgelement image){
ihtmlelement元素=(ihtmlelement)image;
字符串src =(string)element.getAttribute(“ src”,2);
如果(src!= null){
uri addr = new Uri(RelativeLocation,src);
image.src = addr.absoluteuri;
}
}
字符串ret = doc.body.innerhtml;
返回ret;
}