473,467 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to catch a click on webbrowser :(

Hi

I want to catch the clicks for a special hyperlink on a webbrowser component
in order to activate the print setup section of my program. I cannot use
javascript because I must handle the printable document, in fact, create it
dynamically using program. I got stuck here, how can I do that?
Can I use a special javascript command that sends browser any message and
warn it or something like that?
Any idea?
appreciate any help...
Thanks
Feb 28 '07 #1
3 12240
The HTML page hosted in WebBrowser component can call back the application.
You need to add a little thing in the HTML file to handle the onclick event
of the special link:
Like this:
<a href="whatever" onclick="window.external.Test('called from script
code')">CLICK ME</a>

When clicked, the page will call your apps Test method passing the string as
a parameter.
This way you can make callbacks from the page to your app.
Just remember to set the ObjectForScripting property to this
(webBrowser1.ObjectForScripting=this;).
"Aleyna[]" <xo******@gmail.comha scritto nel messaggio
news:Oq**************@TK2MSFTNGP06.phx.gbl...
Hi

I want to catch the clicks for a special hyperlink on a webbrowser
component in order to activate the print setup section of my program. I
cannot use javascript because I must handle the printable document, in
fact, create it dynamically using program. I got stuck here, how can I do
that?
Can I use a special javascript command that sends browser any message and
warn it or something like that?
Any idea?
appreciate any help...
Thanks


Feb 28 '07 #2
Am Wed, 28 Feb 2007 19:04:05 +0100 schrieb Laura T.:
The HTML page hosted in WebBrowser component can call back the application.
You need to add a little thing in the HTML file to handle the onclick event
of the special link:
Like this:
<a href="whatever" onclick="window.external.Test('called from script
code')">CLICK ME</a>

When clicked, the page will call your apps Test method passing the string as
a parameter.
This way you can make callbacks from the page to your app.
Just remember to set the ObjectForScripting property to this
(webBrowser1.ObjectForScripting=this;).
Interesting!

I have a similar need: I need to access the DOM element a user identifies
with the mouse. (Background: user is interested in certain parts of a
webpage and wants to have the data extracted). Is there a possibility to
find the element in the DOM the mouse is over or clicked etc, without
adding anything to the page?

Tnx!
Mar 1 '07 #3
Thanks for your reply Laura.

I tried it and it works exactly as I want.

"Laura T." <LT@NOWHERE.COM>, haber iletisinde þunlarý
yazdý:%2***************@TK2MSFTNGP05.phx.gbl...
The HTML page hosted in WebBrowser component can call back the
application.
You need to add a little thing in the HTML file to handle the onclick
event of the special link:
Like this:
<a href="whatever" onclick="window.external.Test('called from script
code')">CLICK ME</a>

When clicked, the page will call your apps Test method passing the string
as a parameter.
This way you can make callbacks from the page to your app.
Just remember to set the ObjectForScripting property to this
(webBrowser1.ObjectForScripting=this;).
"Aleyna[]" <xo******@gmail.comha scritto nel messaggio
news:Oq**************@TK2MSFTNGP06.phx.gbl...
>Hi

I want to catch the clicks for a special hyperlink on a webbrowser
component in order to activate the print setup section of my program. I
cannot use javascript because I must handle the printable document, in
fact, create it dynamically using program. I got stuck here, how can I do
that?
Can I use a special javascript command that sends browser any message and
warn it or something like that?
Any idea?
appreciate any help...
Thanks



Mar 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Robert May | last post by:
I have an application that uses the Ax web browser object. When I call the IHTMLElement.click() method on an input button (<input type="submit"> or <input type="button">), the click fires...
24
by: ej1002 | last post by:
Hi I have developed a Windows Application(C# Windows Form) which will get the IFrame Source of the page it is navigating using Webbrowser Control. Now I want do this in ASP.Net web application(C#...
11
by: Terry Olsen | last post by:
How can I catch a right-click on a DropDownMenuItem?
2
by: cweeks78681 | last post by:
I am porting some VB6 code that automates navigation through a web page by getting all the <a> tags into a collection and then calling the Click method on the appropriate one. How do I click a...
3
by: cweeks | last post by:
I use the InvokeMember("Click") method of HtmlElement to click a button in a web page using the Webbrowser control that is new in VS 2005 C# Express. Now I need to be able to select a member of a...
0
by: Steph | last post by:
hello, i testing webbrowser (c# .net2) , and my webbrowser take a random website in google (to test). and.... i found a problem with a security alert.... in this site :...
2
by: JDeats | last post by:
Using VS.NET 2005, if you place a WinForms WebBrowser control on a form, then place a command button on that form and in the "click" even handler for the command you do: webBrowser1.DocumentText...
0
by: cheenusri | last post by:
Hello friends, i am running slide show(pps file) in vb.net form using webbrowser control in it.while running the form, if right click on the slide, it show some popup menu, here i wan to...
1
by: Rotsey | last post by:
Hi, I have a form with a webbrowser control set to fill the form. I want to capture when the form is clicked. As the browser control is filling the form the user would click on the browser...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.