PC Review


Reply
Thread Tools Rate Thread

Capturing Alert()'s in Browser control

 
 
Fryguy
Guest
Posts: n/a
 
      29th Aug 2003
Situation:
-- VB.NET Windows app with embedded Browser control
-- Browser control loads form-based text entry web app (not ours, I
have no control over the HTML or the script that comes up)
-- Pages of web app contain field validation via JavaScript
-- Validation throws alert()'s to indicate failed validation
conditions

How can the WinForms app intercept those alerts? Since the app I'm
writing is all about auto-populating the external form with our data,
I need to handle the conditions that arise when our data does not pass
the validation functions. Ultimately, I'd like to record the text of
the alert, but can't figure out how.

I've gone down the following paths without success:
-- Try to find an event on the Browser control that would tell me
anything (nope)
-- Try to find an event on the mshtml.HTMLDocument object that would
tell me something (nope)
-- Find a way to inject a new script function (myalert) into the DOM
that would do the normal alert and raise a browser event, and try
iterating through the mshtml.HTMLDocument.scripts collection,
replacing each alert('xyz') with myalert('xyz'). Several problems
with that approach...having trouble injecting the new function, don't
know what browser event to raise that I could handle externally, the
scripts that the pages use are external (<script src="blah.js"/>).

Anyone have any ideas?

Could I go lower than this and try to handle window creations for the
alert windows? I haven't a clue whether this is even possible, let
alone how to tackle it.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing all HTTP traffic between browser and server in .NET gomisha Microsoft C# .NET 3 26th Jun 2006 08:35 PM
Capturing Button click event in a Browser Helper Object Sujoan Microsoft C# .NET 0 6th Mar 2006 02:23 PM
Capturing button click thru Browser Helper Object Sujoan Windows XP Internet Explorer 0 6th Mar 2006 02:21 PM
ie browser alert =?Utf-8?B?Y2hhcmxleQ==?= Windows XP Internet Explorer 2 5th Oct 2005 09:58 PM
Capturing Windows Username without popping challenge box in the browser Raj Thakkar Microsoft ASP .NET 8 9th Dec 2004 07:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:05 PM.