I have saved web pages(example yahoo.com) to local file system. When opening it in browser(the URL looks like file:///home/…/*.html) the web page tries to connect to Internet(to download the ads, e.t.c). What has to be modified in the web page to stop it from connecting the Internet(server). I don’t want to use ad-block add-ons for the browser, instead wish to change the web-page such that it should never try to connect to any server at all.
I have saved web pages(example yahoo.com) to local file system. When opening it in
Share
You make it stop requesting external resources by removing references to external resources. There is no real flag or switch that handles this. The modern webpage is a very interconnected thing, loading data from lots of domains for all kinds of different reasons. (Google hosted JS frameworks, images from social networks, or images/css/js served from different CDN domains to speed up loading, etc.)
If you really need to do this, I would search the page for
"http"and remove or alter the HTML element where it finds a match. Any reference to an external file should start with “http” so that should find them all.In some cases you may be able to copy the resource from the external server and save it to a local file, then point the reference to a local relative url instead.
How to remove those reference without breaking the whole page, well that depends on a lot of things like what the resource is and what it’s responsible for. And that’s impossible to advise on without the actual source of the page.
And it gets extra hairy with JavaScript. You may have JS that inserts images, for instance, and is hardcoded to load those form a specific domain. So now you have to edit that JS too to load local images instead.
So uh, yeah. Good luck.
Or perhaps you just want something like HTTrack to do it for you?