如何让webbrowser控件浏览网页时不下载flash(*.swf)和图片(*.gif,*.jpg)

解决方案 »

  1.   

    在BROWSER的继承属性中的浏览器控制,设置禁止ACTIVEX和图片
      

  2.   

    1、不下载图片等内容只需在IE的Internet选项高级栏中去掉“多媒体”相应项前的
        对勾即可。
    2、不下载或播放flash,请将下述内容导入注册表。
    REGEDIT4[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF- 96B8-444553540000}]
    "Compatibility Flags"=dword:00000400
    3、如果要恢复Flash的播放请在HKEY_LOCAL_MACHINE前加-I found this on the web but didn抰 test it:A class to toggle image display in Internet Explorer 5.A year ago I had an article published in Delphi Developer on writing
    Web-robots using the twebbrowser that is part of Internet Explorer and which
    you can install in Delphi 3 or 4 and comes pre-installed in Delphi 5. This
    article is also on Borland抯 website at
    http://www.borland.com/delphi/news/delphi_developer/bolton/My only gripes with using Twebbrowser are that there is a fair bit of
    baggage- it renders every web-page which slows things down (especially when
    it has to retrieve every image on the page). The class below implements a
    way of disabling image display (toggling the IE switch programmatically) in
    IE 5 to speed up web-robots written using it. It hasn抰 beeen tested in IE 4
    or IE 5.5 though I suspect it will probably work.type
    TViewIEImage = class
    private
    fSavedimagesVisible: Boolean;
    function GetState: Boolean;
    procedure SetVisible(Visible: Boolean);
    public
    BroadcastChange: Boolean;
    constructor Create;
    destructor Destroy; override;
    property ImagesVisible: Boolean read GetState write SetVisible;
    property SavedImagesVisible: Boolean read fSavedimagesVisible write
    fSavedimagesVisible;
    end;constructor TViewIEImage.Create;
    begin
    fSavedimagesVisible := GetState;
    BroadcastChange := True;
    end;destructor TViewIEImage.Destroy;
    begin
    SetVisible(fSavedimagesVisible);
    end;function TViewIEImage.GetState: Boolean;
    begin
    Result := GetRegistryValue = 抷es?
    end;procedure TViewIEImage.SetVisible(Visible: Boolean);
    var
    Reg: TRegistry;
    Str: string;
    begin
    if Visible then
    Str := 抷es?br> else
    Str := 抧o?
    Reg := TRegistry.Create;
    try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey(抃Software\Microsoft\Internet Explorer\Main?
    False) then
    Reg.WriteString(扗isplay Inline Images? Str);
    finally
    Reg.CloseKey;
    Reg.Free;
    inherited;
    end;
    if BroadcastChange or Visible then
    PostMessage(
    HWND_BROADCAST,
    WM_WININICHANGE,
    0,
    Longint(pchar(扝KEY_CURRENT_USER\Software\Microsoft\Internet
    Explorer\Main?));
    end;