?
Solved

How can I disable a certain Javascript block in WebBrowser

Posted on 2006-04-29
8
Medium Priority
?
1,782 Views
Last Modified: 2012-06-27
Some site has Hacker Code with Javascript and VBScript and I try to find a way to protect IE by avoiding these Hacker Code Block execute.
I had wrotten a BHO to monitor my IE, but how can I disable a certain javascript/vbscript block before the script executing in IE ?
0
Comment
Question by:xlt77
7 Comments
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 16572884
one way would be to have a proxy to avoid downloading such blocks

http://www.proxomitron.info/
0
 
LVL 2

Author Comment

by:xlt77
ID: 16575480
I won't to use third-party product, and I just want to implement it with delphi.
0
 
LVL 26

Expert Comment

by:Eddie Shipman
ID: 16580412
Not sure if it will help because I don't have time to test it.
Please check item No. 2 here:
http://www.delphipages.com/threads/thread.cfm?ID=101040&G=100927

I *know* it says to stop javscript errors but you can override all javascript
in the same manner. Only problem is that you will need to know *WHICH*
script to block. I'll leave that up to you.
0
Industry Leaders: 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!

 
LVL 2

Author Comment

by:xlt77
ID: 16619805
I am sorry that I show my question not clearly.
When I navigate a web site on internet , I want to forbidden a certain javascript block before this script code execute.
Forbidden it before executing ,  not dealing it on Runtime Error
0
 
LVL 26

Expert Comment

by:Eddie Shipman
ID: 16630359
I'm sorry you did not READ my answer correctly...

"but you can override all javascript in the same manner"

0
 
LVL 2

Author Comment

by:xlt77
ID: 16637110
Yeah, EddieShipman, thanks your commence!
I had tried your answer, in fact , the script has run before the documentcomplete event.

=====Here is the html=======
<html>
<head>
<script type="text/javascript" src="test1.js"></script>
<script type="text/javascript" src="test2.js"></script>

<script>
  alert('This is a test');
</script>
</head>

<body>
This is a test
</body>
</html>

=====Delphi code =========
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
begin
  showmessage(inttostr(webbrowser1.OleObject.document.all.tags('SCRIPT').length));
end;

And the result shows 'This is a test' is been displayed before the scripts length.

and I tried this code in DownLoadComplete event, I found DownloadComplete event ocused before javascript executing, but in DownloadComplete event , I can get only 1 Scripts item. Thus , in downloadComplete event
webbrowser1.OleObject.document.all.tags('SCRIPT').length  =  1

It's so confused that I can't get the whole scripts code before IE auto execute them.
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16981974
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question