Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java api for downloadin a web page along with CSS and javascript files

 
Jeyram Tamate
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I require a java api which could download a website page along with css and javascript files so that when it is opened offline it should have all the css and javascript effects. Any suggestions would be welcome. Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if any existing Java crawlers support downloading external dependencies. It wouldn't be hard to write one though. You'd get the URL text as a string. Then go through it to get the javascript/css links and download those as strings too.
 
Paul Clapham
Sheriff
Posts: 21317
32
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's already a "Save as..." option in the menu of many browsers (IE and Firefox for sure) which tries to do that.

However in the tests I ran, that option didn't work very well. A lot of modern pages seem to use techniques which involve loading CSS and/or Javascript at run time, rather than statically. I expect that anything you found would suffer from the same problem.
 
Jeyram Tamate
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Jeanne Boyarsky.
After going through some java crawlers I feel its good to write one which I require for my specific need. Now I will download the complete page and also I will download all the javascript and css dependencies through program and will place it to appropriate folders. I hope this would solve my problem. But the javascript which is loaded on runtime is creating problem.
The link for Java Crawlers you have provided is helpful. At least I have some API's where I can look .

Once again thank you for giving your time.
 
Jeyram Tamate
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul Clapham
Yes you are right runtime javascript loading is something which is creating problem.

Thanks for giving your time.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic