Just like Firefox does...

H

himgi

Hi to all, how do i save a complete web page?

Let' say I have and HTML file and I want to save all its content and
even its resources...
Images, ".js", ".css".

What should I do?
Is there a tool or API which does this for me?

Any way... any ideas???

Thakns to all, Himgi
 
R

Rhino

himgi said:
Hi to all, how do i save a complete web page?

Let' say I have and HTML file and I want to save all its content and
even its resources...
Images, ".js", ".css".

What should I do?
Is there a tool or API which does this for me?

Any way... any ideas???

Thakns to all, Himgi
You use File/Save on the program that creates the file; then the file is
saved to the directory of your choice. The JFileChooser class can be used to
accomplish this in a Java program. For an example of how to use
JFileChooser, look at
http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html.
 
?

=?ISO-8859-1?Q?Jan_Thom=E4?=

Rhino said:
You use File/Save on the program that creates the file; then the file is
saved to the directory of your choice. The JFileChooser class can be used to
accomplish this in a Java program. For an example of how to use
JFileChooser, look at
http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html.


I think that is not quite the answer he wanted;).

Actually you can use HTTPUnit to analyze the contents of a webpage and
download additional resources. A very simple approach would be using
regular expressions to grab the URLs of all external resources, download
the files via HTTPUnit and then replace the URls in the original HTML
with the location of the downloaded file and finally saving the modified
html.

Best regards,
Jan
 
J

jcsnippets.atspace.com

Hi to all, how do i save a complete web page?

Let' say I have and HTML file and I want to save all its content and
even its resources...
Images, ".js", ".css".

What should I do?
Is there a tool or API which does this for me?

Any way... any ideas???

Thakns to all, Himgi

Have a look at HttpURLConnection to load the html data from a website.
Then, have a look at http://htmlparser.sourceforge.net/ to look for links
inside the html.

After you have found said links, download the css, images and the rest with
new HttpURLConnections.

If you're unsure or can't figure it out, please reply, and I'll whip up
some examples this evening.

Best regards,

JayCee
 
H

himgi

Thank you very much to all of you.

I guess HTMLParser is just great... I still have to try it.. but
reading some doc and examples on the site it fits my needs...

°__^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top