Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Programming Talk / Delphi - Make A WebBrowser that can view the source and/or save the site to file Help

Author
Message
The Lone Programmer
22
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 14th Jul 2005 09:32
Hey,

I wanted to make a simple little web browser and I am at the point where I would like to know how to add a command to view the source code of the web page. Is it possible? How?

Also, how would I be able to save the web page to file? Like save the page to a text file so that way its in code form instead of viewing pleasure form.

I am using the standard TWebBrowser command. No special Indy Commands.

I would appreciate the help.

Thanks,
The Lone Programmer

"Is The Juice Worth The Squeeze"
-The Girl Next Door
PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 14th Jul 2005 22:01
try opening the file as a text document.

Can you say the language your using?

Feel free to contact me on MSN,

Always available to help
MicroMan
21
Years of Service
User Offline
Joined: 19th Aug 2003
Location: Stockholm, Sweden
Posted: 14th Jul 2005 23:49 Edited at: 14th Jul 2005 23:59
@Powersoft

He's using Delphi.

@The lone programmer

[Old post: I'm at the office so I don't have access to Delphi, but if I don't recall wrong there should be a 'document' property of the TWebBrowser control. That's the key, because the document-property will contain the HTML.]

Sorry, I remembered wrong, but here's a page that shows what you can do:

http://www.delphidabbler.com/articles.php?article=14

-----
They SAID that given enough time a million monkeys with typewriters could recreate the collected works of William Shakespeare... Internet sure proved them wrong.
-----
PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 15th Jul 2005 00:44
Still the theory still provides

Open the document up. Read it. Output it to the source file

Always available to help
The Lone Programmer
22
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 15th Jul 2005 00:58
That site honestly sucks for an easy tutorial.

They extend it to more than what it really is.

How do I set the Directory so that way when I try and load a file into a memobox I can do any file including websites just like I can with windows? When I try and load the files it always looks in the directory with the exe.

I want it to have no directory. I dont even want it to see the c: drive if that is possible. I want to be able to do:


Easy as that.

This tutorial shows you how to do so much crap that you probably dont need.


Any suggestions?

Thanks,
The Lone Programmer

"Is The Juice Worth The Squeeze"
-The Girl Next Door
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 15th Jul 2005 03:31
You can save the Html content of a TWebbrowser control to a stream and load it back to a memo for example.





Play Nice! Play Basic! Version 1.073
The Lone Programmer
22
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 21st Jul 2005 08:18
Your little function didn't work. I think your command syntax's are incorrect.

I searched around google for a little while and came accross this.



Works very good. I do have a question though.
The code I just supplied saves the source of the webpage to a file and then I must load it into my memo box. How can I manipulate the code I found to read it into a memo box without saving it? In other words load it in on the fly. Would I load it in as a stream? If so how?


Thanks,
The Lone Programmer

"Is The Juice Worth The Squeeze"
-The Girl Next Door
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 21st Jul 2005 18:20
This works.



Play Nice! Play Basic! Version 1.08

Login to post a reply

Server time is: 2025-05-17 18:52:01
Your offset time is: 2025-05-17 18:52:01