Blocking Delphi TWebBrowser Error Alerts
While opening some sites in Delphi TWebBrowser you can give bug warnings in a row in a boring way. In addition to using the Slient feature, registry settings can be disabled.
Manually; From the Registry settings, from the Tools menu, in Internet options, and then on the Advanced tab, you can disable script debugging and check that there are no more script errors.
It can also be done by modifying this registry key by coding in your program.
Path : SOFTWARE\Microsoft\Interne
key: Disable Script Debugger
Values : yes (no script dialogs)
The code required to do this is given below.
procedure SilenceDebugger(const newStr: string = 'yes');
var Reg : TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('SOFTWARE\Microsoft\Inte rnet Explorer\Main\
',false) then
begin
Reg.WriteString('Disable Script Debugger',NewStr);
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE,0,
LongInt( PChar('Software\Microsoft\Internet Explorer') ));
end;
finally
Reg.CloseKey;
Reg.Free;
end;
end;