This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes How to save a complete webpage including images etc? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "How to save a complete webpage including images etc?" Watch "How to save a complete webpage including images etc?" New topic
Author

How to save a complete webpage including images etc?

Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
I need to write a java program to to save a complete webpage including images etc. to my local disk? How do I achieve this? If I use a URL connection, I can only save the page and not its resources like images etc.

Please help.


Thanks and Regards
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

You will need to parse the content, possibly modify it because of links to resources on different servers, or in paths that are not a sub folder of the web page's folder (e.g. src="../images/image.gif"). That's not a trivial job though. Regular expressions or a proper HTML parser can help you out here.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to save a complete webpage including images etc?
 
Similar Threads
snap shot of web page with JavaScript
How can I email a complete webpage using java mail?
SAVE AS with memu bar
how to save-as with linked documents
how to save images