473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 12237
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.