Examples‎ > ‎

Document HTML content

The sample shows how to get the original HTML of a currently loaded document. Like the "View source" command in context menu of Internet Explorer application:
import com.jniwrapper.win32.ie.HeadlessBrowser;
 
/**
 * The sample shows how to get the original HTML of a currently
 * loaded document.  Like the "View source"  command in context
 * menu of Internet Explorer application.
 */
public class GetDocumentSourceSample {
    public static void main(String[] args) {
        HeadlessBrowser browser = new HeadlessBrowser();
        browser.navigate("http://www.google.com");
        browser.waitReady();
 
        String html = browser.getContent(true);
        System.out.println("html = " + html);
    }
}