-1

I am creating a Java based application (a very tiny one) that downloads web-pages based on the URL that the user inputs.Now,the application does so, but shows only the source (HTML/JavaScript). How do I display the web-pages directly?

Prashant Pandey
  • 139
  • 1
  • 1
  • 13
  • By pushing the content into a browser? Or are you seriously asking us how to "on the fly" program a java application that is able to display all kinds of web content? Seriously? – GhostCat Feb 10 '16 at 17:02
  • 1
    Possible duplicate of [Pure Java HTML viewer / renderer](http://stackoverflow.com/questions/2438201/pure-java-html-viewer-renderer) – Arnaud Feb 10 '16 at 17:07
  • What is the intent of your application? – Clark Kent Feb 10 '16 at 17:07
  • I was thinking a kind of mini-browser,a very basic one.The user inputs the URL, and the home-page is displayed.(The hyperlinks won't work obviously). – Prashant Pandey Feb 10 '16 at 17:28

2 Answers2

1

Short answer: render it.

Long answer: you need a web engine (HTML/JS/CSS parser + renderer on a canvas). This includes but not limited to Qt webkit, Chrome Embedded Framework, Gecko. There could be existing pure Java solution as well, but I don't know.

Alternative solution is to open it with a web browser by giving path to the downloaded web pages.

LeleDumbo
  • 9,192
  • 4
  • 24
  • 38
0

You can save the downloaded web pages and open it through any browser, if you want it to be programmatically, then you have to re-host the content locally on web server and then you could use selenium to open the webpage on any given browser.

Shek
  • 1,543
  • 6
  • 16
  • 34