• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3385
  • Last Modified:

TWebBrowser JavaScript error...

Hello All,

I'm trying to open some pages in my program using TWebBrowser and when page has JavaScript error it shows me standrard error box...

How can I turn off it?

Now I'm using same code:
---
    with(Browser)do begin
      try
        Index:=OleObject.Document.all.tags('SCRIPT').Length;
        if(Index>0)then begin
          Scripts:=OleObject.Document.all.tags('SCRIPT').item(0);
          Scripts.Text:='window.onerror=function(){return true};'+Scripts.Text;
        end;
      except
        {### BLOCK ALL ERRORS ###}
      end;
    end;
---

But it seems that sometimes this code works properly but sometimes no...

Does somebody have code for turn off ALL JavaScript errors in TWebBrowser...

Thanks,
Dan
0
DanDaemon
Asked:
DanDaemon
  • 2
  • 2
1 Solution
 
geobulCommented:
Hi,

There is a setting for that in InternetExplorer options - Advanced tab - 'Display a notification about every script error'. You may turn it off manually or using the registry. For WinXP the key:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Error Dlg Displayed On Every Error
has to be set to the string:
no

Regards, Geo
0
 
DanDaemonAuthor Commented:
Thanks Geo,

But I think change the registry is not correct method... because it will do affect to all system...
Maybe you know another method?

Thanks,
Dan
0
 
geobulCommented:
No, I don't. Sorry.
0
 
Eddie ShipmanAll-around developerCommented:
There was a thread about the very subject on the Delphi-WebBrowser mailing list back in Feb 01. Here's the link.

The thread was titled "OnRefreshComplete?" by Adam Stiles.

In particular is this message:

http://groups.yahoo.com/group/delphi-webbrowser/message/3335
0
 
DanDaemonAuthor Commented:
Thanks EddieShipman, I found here what I was needed!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now