How to programmatically download all contents of webpage, not only the source code in Java


Tags: java,javascript,android,html,css

Problem :

I know how to download a webpage's source in java. But a webpage also contains image url, CSS and JS script url which need to be downloaded later like:

<LINK REL="STYLESHEET" HREF="htmlatex.css">
<img src=p10012.gif>

If I only download the source of a webpage, rendering it in offline mode will need to download this htmlatex.css and p10012.gif result in missing contents in offline mode. My objective is to download all contents of webpage programmatically and provide it as assets of an android app. HOw can I do that in java.

Note: please let me know if my question is not clear enough.



Solution :

I would suggest to use JSoup library to do it as its pretty good HTML parse. You can parse HTML and than iterate over resources to download them. I am not sure but there should be an example on the same topic you asked.


    CSS Howto..

    How to prevent conflicts between css rules

    How to have a background image wider than the content area of a website (without scrollbars)

    How to avoid the div 'move' when mouse hover?

    CSS: How to make a nav menu with a sub nav menu directly below it?

    How do I make a textarea resize properly when I resize browser window?

    How can I make a designer's static web page run in rails 4

    how to combine multiple css class selectors for jquery buttonset?

    How to keep css elements from moving during transition

    Javafx CSS How to inherit background color from other css settings

    How to wrap entire line with overline and underline , until the end of the line ?

    How to make div to match image height with CSS

    Showing the selected value on the handler of range input as the value changes

    How to make a CSS transform affect the flow of other elements

    How do I make the mobile view of my website not show certain elements?

    Cache policy, css/js/images how to make them not to load each time i do full postback?

    HTML - How to put text over a white background over a background image

    jQuery How to select the only child of a
  • inside a class
  • How to reverse a repeated image on blogger

    How can I make a 2-level navigation bar? [closed]

    How to override a templates default option with javascript and css

    How to make a sudoku grid using HTML and CSS?

    How to remove space from top of web page

    CSS HTML How to align image within div to bottom right

    How to create a dynamic box with shadow - using PNG pictures

    How do I wrap a overflowed span in fixed div

    How to change css href=“” using javascript? [duplicate]

    How do I take multiple CSS files with the exact same selectors and force one to be used only on a specific div?

    how to make colors generated via Javascript be stored permanently in CSS file with or without use of PHP

    how to link stylesheet in css

    How do I get two side by side divs displayed correctly inside a bordered, dynamic height content area?