473,326 Members | 2,196 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,326 software developers and data experts.

View browser page source from another app?

How can I get the page source from a browser window running on the same
box as my program?

shishudas

*** Sent via Developersdex http://www.developersdex.com ***
Jan 4 '06 #1
8 1365
"Shishu Das" <sh********@gmail.com> schrieb:
How can I get the page source from a browser window running on the same
box as my program?


If you are using Internet Explorer:

\\\

' Requires a reference to "Microsoft Internet Controls" ("SHDocVw.dll").
On Error Resume Next
For Each IE As InternetExplorer In New ShellWindows
MsgBox(IE.Document.DocumentElement.innerHTML)
Next IE
On Error GoTo -1
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jan 4 '06 #2
Herfried's solution will get you the current state of the DOM including
DHTML modifications - this is probably what you want. In the case that you
want to display the "true" source (what was initially downloaded) see
http://support.microsoft.com/?kbid=311288

--
Colin Neller
http://www.colinneller.com/blog
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e2**************@tk2msftngp13.phx.gbl...
"Shishu Das" <sh********@gmail.com> schrieb:
How can I get the page source from a browser window running on the same
box as my program?


If you are using Internet Explorer:

\\\

' Requires a reference to "Microsoft Internet Controls" ("SHDocVw.dll").
On Error Resume Next
For Each IE As InternetExplorer In New ShellWindows
MsgBox(IE.Document.DocumentElement.innerHTML)
Next IE
On Error GoTo -1
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 4 '06 #3
Herfried,

Thanks! But, can you explain how to do this "reference" in VB.Net. I'm
new to this platform, and haven't fully RTFM.

Thanks!

shishudas

' Requires a reference to "Microsoft Internet Controls" ("SHDocVw.dll").
*** Sent via Developersdex http://www.developersdex.com ***
Jan 4 '06 #4
"Shishu Das" <sh********@gmail.com> schrieb:
Thanks! But, can you explain how to do this "reference" in VB.Net. I'm
new to this platform, and haven't fully RTFM.


"Project" -> "Add reference..." -> "COM" -> "Microsoft Internet Controls".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jan 4 '06 #5
Got the reference OK, but it's still not liking this syntax. Just to
make this a little harder, I should mention that I would like to detect
(with a global hook) where the user clicked on the web page, so I can
tell what section of text they are looking at...

shishudas


*** Sent via Developersdex http://www.developersdex.com ***
Jan 4 '06 #6
shishudas,

I suggest you try using the C# WebBrowser wrapper available at
http://www.codeproject.com/cs/miscctrl/WebBrowserEx.asp. It does a lot of
the "pluming" required to make the WebBrowser behave like you want
(including sinking the IHTMLDocument2 to capture click events.) Also, I
have a blog post that lists several WebBrowser control resources I have
found useful:
http://www.colinneller.com/blog/Perm...15665bc5d.aspx

--
Colin Neller
http://www.colinneller.com/blog
"Shishu Das" <sh********@gmail.com> wrote in message
news:ek**************@TK2MSFTNGP09.phx.gbl...
Got the reference OK, but it's still not liking this syntax. Just to
make this a little harder, I should mention that I would like to detect
(with a global hook) where the user clicked on the web page, so I can
tell what section of text they are looking at...

shishudas

Jan 4 '06 #7

Colin,

Thanks again!

I notice a reference to new features in .Net 2.0 that might make this
easier. Should I just upgrade to the new version and use those? Are you
familiar with them?

shishudas

*** Sent via Developersdex http://www.developersdex.com ***
Jan 4 '06 #8
shishudas,

Honestly, I have no experience with the 2.0 WebBrowser control other than
small test applications. If you want FULL control over the WebBrowser,
you're probably better off doing it yourself (starting with the wrapper),
but if you can live with the limited functionality that the 2.0 control
gives you, do it... it's MUCH easier.

--
Colin Neller
http://www.colinneller.com/blog
"Shishu Das" <sh********@gmail.com> wrote in message
news:uU**************@TK2MSFTNGP15.phx.gbl...

Colin,

Thanks again!

I notice a reference to new features in .Net 2.0 that might make this
easier. Should I just upgrade to the new version and use those? Are you
familiar with them?

shishudas

*** Sent via Developersdex http://www.developersdex.com ***

Jan 4 '06 #9

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

Similar topics

5
by: Pete Wason | last post by:
Hiall! I have a demo viewer page for javascript stuff that has three buttons "DEMO" "HTML" and "JSCR", and an IFRAME called 'viewer'. Initially, the IFRAME gets loaded with the actual demo...
4
by: k | last post by:
A programming the internet class has been asked if it is possible to 'grey out' the View Source option in a browser menu. Multiple respondents think it is possible but not sure how to do it. I have...
8
by: Nancy | last post by:
Hi, Guys, I don't know why I can't view some webpages source code by click "View->Source" menu of Browser. These webpage source code can be viewed in same way by using other computers. My OS is...
15
by: Michael Hill | last post by:
I saw a site that looked pretty good, but I could view the source. 2 questions: 1) how can I do the same for my site 2) any way to get around this? Mike
18
by: Lorem Ipsum | last post by:
interesting! I just found a page in which Explorer's View Source does nothing! How did they do that?
8
by: Alvo von Cossel I | last post by:
hey everybody, I have written a great browser but it is missing a feature (quite a lot actually, but forget about them for now). that feature just so happens to be the View > Source function....
3
by: Philip Tripp | last post by:
I've read numerous sources stating that view state can be disabled per control, and per page, but can't seem to keep web form controls from remembering their state on a postback. I'm using VS.Net...
3
by: Frank | last post by:
Hi, I'm experimenting with aspx. When I build a form with code-behind code it's possible to run with a mouse right-click and menu 'view in browser'. A browser window is opened within VB.NET. Works...
6
by: jwwishart | last post by:
For some reason I'll view an aspx page and... 1. Scripts that I add (using the RegisterStartupScript method of the Page object) dont show up in the source(IE->View Source)even thought I know...
3
by: Stefan Schwarzer | last post by:
Hello, from time to time I want to inspect the source code of projects on remote computers.(*) I've googled for one or two hours but didn't find anything helpful. :-/ I'm looking for something...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.