ʹÓÃTWebBrowser×é¼þ±£´æÍøÒ³ÎªhtmlºÍmhtÎļþ ÊÕ²Ø
ʹÓÃTWebBrowser×é¼þ±£´æÍøÒ³ÎªhtmlºÍmhtÎļþ ÊÕ²Ø
Ò»¡¢±£´æÎªHTMLÎļþ
uses ActiveX;
...
procedure WB_SaveAs_HTML(WB : TWebBrowser; const FileName : string) ;
var
PersistStream: IPersistStreamInit;
Stream: IStream;
FileStream: TFileStream;
begin
if not Assigned(WB.Document) then
begin
ShowMessage('Document not loaded!') ;
Exit;
end;
PersistStream := WB.Document as IPersistStreamInit;
FileStream := TFileStream.Create(FileName, fmCreate) ;
try
Stream := TStreamAdapter.Create(FileStream, soReference) as IStream;
if Failed(PersistStream.Save(Stream, True)) then ShowMessage('SaveAs HTML fail!') ;
finally
FileStream.Free;
end;
end; (* WB_SaveAs_HTML *)
ʹÓ÷½·¨£º
WebBrowser1.Navigate('http://www.uufax.com') ;
//then save
WB_SaveAs_HTML(WebBrowser1,'c:\WebBrowser1.html') ;
¶þ¡¢Áí´æÎªMHTµ¥Ò»Îļþ
uses CDO_TLB, ADODB_TLB;
...
procedure WB_SaveAs_MHT(WB: TWebBrowser; FileName: TFileName) ;
var
Msg: IMessage;
Conf: IConfiguration;
Stream: _Stream;
URL : widestring;
begin
if not Assigned(WB.Document) then Exit;
URL := WB.LocationURL;
Msg := CoMessage.Create;
Conf := CoConfiguration.Create;
try
Msg.Configuration := Conf;
Msg.CreateMHTMLBody(URL, cdoSuppressAll, '', '') ;
Stream := Msg.GetStream;
Stream.SaveToFile(FileName, adSaveCreateOverWrite) ;
finally
Msg := nil;
Conf := nil;
Stream := nil;
end;
end; (* WB_SaveAs_MHT *)
ʹÓ÷½·¨£º
//first navigate
WebBrowser1.Navigate('http://www.uufax.com') ;
//then save
WB_SaveAs_MHT(WebBrowser1,'c:\WebBrowser1.mht') ;
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/sunstone/archive/2009/11/09/4788743.a
Ïà¹ØÎĵµ£º
HTML <link> ±êÇ©
¶¨ÒåºÍÓ÷¨
<link> ±êÇ©¶¨ÒåÎĵµÓëÍⲿ×ÊÔ´µÄ¹ØÏµ¡£
<link> ±êÇ©×î³£¼ûµÄÓÃ;ÊÇÁ´½ÓÑùʽ±í¡£
ʵÀý
Á´½ÓÒ»¸öÍⲿÑùʽ±í£º
<head>
<link rel="stylesheet" type="text/css" href="theme.css" />
</head>
TIY
ä¯ÀÀÆ÷Ö§³Ö
ÔÚÓÃÓÚÑùʽ±íʱ£¬<link> ±êÇ ......
ÏÂÃæÕâ¸öÍøÕ¾ÂÞÁÐÁË£¬¼¸ºõËùÓеĹØÓÚHTML 5 ÔÚ¸÷ÖÖÖ÷Á÷ä¯ÀÀÆ÷ÉϵݲȫÎÊÌ⣬ÕâЩ°²È«ÎÊÌâºÜÓпÉÄܽ«»áÊǺڿ͹¥»÷ÄãµÄÍøÉϵÄÇÃÃÅש£¬ËûÃǼ¸ºõ¶¼ºÍJavascript¶¼ÓйØÏµ£¬Äã¾ÍÒªºÃºÃ×¢ÒâÁË¡£
http://heideri.ch/jso/
ÏÂÃæÂÞÁм¸¸ö£º
1£©<table background=”javascript:alert(1)”>
IE6£¬7£¬8£¬9£¬ºÍOpera ......
map
:¶¨ÒåÒ»¸ö¿Í»§¶ËͼÏñÓ³É䡣ͼÏñÓ³É䣨image-map£©Ö¸´øÓпɵã»÷ÇøÓòµÄÒ»·ùͼÏñ¡£
ÊôÐÔ£º
name£º Ϊ image-map ¹æ¶¨µÄÃû³Æ¡£
  ......
function unhtml($content){
$content=htmlspecialchars($content);
$content=str_replace(chr(13),"<br>",$content);
$content=str_replace(chr(32)," ",$content);
return trim($content);
}
......