WebBrowser (MSIE) - Capture JS Errors using Exec of IOleCommandTarget

后端 未结 1 1546
醉话见心
醉话见心 2021-01-03 09:02

I need to capture script errors in MS IE activex control (dubbed as WebBrowser).

As I see it, this is done by implementing the IOleCommandTarget interface in my appl

相关标签:
1条回答
  • 2021-01-03 09:29

    This is the silliest bug in ages! No seriously!

    MS, you really SUCK on this one ;)

    I got it working, my code was actually correct from the beginning (ie, two days ago ;))

    As the article said, you need Disable Script Debugging (Internet Explorer) unchecked.

    BUT Disable Script Debugging (Other) must be checked (in Internet Options > Advanced).

    Weird huh? I got the tip from here: http://www.delphigroups.info/2/9/938468.html (2005-04-29 09:42:48 PM).

    Yes, that's 6 years ago. I'm surprised, no, amazed, that such a thing could be possible and not documented anywhere.

    Edit: Programmatic fix:

    uses Registry;
    
    // ...
    
      with TRegistry.Create do
        try
          RootKey:=HKEY_CURRENT_USER;
          if OpenKey('\Software\Microsoft\Internet Explorer\Main',False) then begin
            WriteString('DisableScriptDebuggerIE','no');
            WriteString('Disable Script Debugger','yes');
            CloseKey;
          end;
        finally
          Free;
        end;
    
    // ...
    
    0 讨论(0)
提交回复
热议问题