xlt77
asked on
How can I disable a certain Javascript block in WebBrowser
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 ?
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 ?
ASKER
I won't to use third-party product, and I just want to implement it with delphi.
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.
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.
ASKER
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
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
I'm sorry you did not READ my answer correctly...
"but you can override all javascript in the same manner"
"but you can override all javascript in the same manner"
ASKER
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.WebBrowser1Document Complete(S ender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
showmessage(inttostr(webbr owser1.Ole Object.doc ument.all. tags('SCRI PT').lengt h));
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.docu ment.all.t ags('SCRIP T').length = 1
It's so confused that I can't get the whole scripts code before IE auto execute them.
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.WebBrowser1Document
const pDisp: IDispatch; var URL: OleVariant);
begin
showmessage(inttostr(webbr
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.docu
It's so confused that I can't get the whole scripts code before IE auto execute them.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.proxomitron.info/