MozillaZine

How to programmatically "Save As.." to download webpage

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
David__
 
Posts: 2
Joined: November 16th, 2015, 10:06 pm

Post Posted November 16th, 2015, 10:12 pm

I haven't found any tool that downloads the page for offline use as correctly as firefox does. The page I'm trying to download is from a site I'm working on that uses MEAN.js, so it's 95% javascript. Is there a javaScript-based tool, or a python-based tool that does the same thing as the "Save As.." firefox feature, just as well as firefox does? What would those types of tools even be called? I've used other tools like wget but it doesn't do nearly as good of a job at figuring out how to convert the page to a static page when it has that much javascript behind it.

LoudNoise
Moderator

User avatar
 
Posts: 40048
Joined: October 18th, 2007, 1:45 pm
Location: Next door to the west

Post Posted November 16th, 2015, 10:16 pm

Moving to web dev.
Post wrangler
"Choose between the Food Select Feature or other Functions. If no food or function is chosen, Toast is the default."

trolly
Moderator

User avatar
 
Posts: 39899
Joined: August 22nd, 2005, 7:25 am

Post Posted November 17th, 2015, 3:38 am

Did you try HTTrack?
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.

David__
 
Posts: 2
Joined: November 16th, 2015, 10:06 pm

Post Posted November 17th, 2015, 9:12 am

I know of it. HTTrack is an independent application. I want to do this programmatically.

trolly
Moderator

User avatar
 
Posts: 39899
Joined: August 22nd, 2005, 7:25 am

Post Posted November 17th, 2015, 10:26 am

Then you need to do it the hard way. Get a page using wget and parse the content.
If you want to see the rendered content from JS you need an additional JS interpreter/JIT and some code which puts the rendered parts in the HTML tree.

In my opinion it is much simpler to use an automation tool for that.

What is the difference between e.g. HTTrack and Firefox when saving sites?
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.

johnmacd
 
Posts: 33
Joined: June 13th, 2013, 4:27 am

Post Posted April 18th, 2016, 5:45 am

You could navigate a System.Windows.Forms.WebBrowser to the URL and then call its ShowSaveAsDiagog() method to save the page.

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 2 guests