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

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

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

Post by David__ »

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.
User avatar
LoudNoise
New Member
Posts: 39900
Joined: October 18th, 2007, 1:45 pm
Location: Next door to the west

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

Post by LoudNoise »

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."
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

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

Post by trolly »

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

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

Post by David__ »

I know of it. HTTrack is an independent application. I want to do this programmatically.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

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

Post by trolly »

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: 34
Joined: June 13th, 2013, 4:27 am

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

Post by johnmacd »

You could navigate a System.Windows.Forms.WebBrowser to the URL and then call its ShowSaveAsDiagog() method to save the page.
WordPress Developer Miami providing best WordPress Websites for small businesses.
Locked