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
DanDaemonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DanDaemonAuthor Commented:
Thanks EddieShipman, I found here what I was needed!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.