Support Forums

How Do I make my website work offline


I can work on my offline available coding preview and coding place Vscode and XAMPP so I can view my preview offline for example localhost/shiny-fascinated-turtle. I want to work with my real domain offline not just localhost and make all of the images available and the site can update. All of this offline.

I once saw a video on this person who has an offline version of his website and is hosted on Netlify but he does not show us how to do it or make it offline.

Can someone tell me

You cannot work with your custom domain name offline without changing your hosts file. Once you do that, however, you will have to change your hosts file again in order to view your site via your custom domain online.

If your custom domain is uprightcode.com, then typically you would use that for online use only, and use uprightcode.local for previewing through XAMPP. This still requires a change to a hosts file (either the one that comes with your system or the one used by XAMPP, depending on your setup), but if you use relative links for everything but the main index.html page everything should work as expected.

1 Like

@gregraven, I think @Codeman is talking about service workers.

Do note that this is not a Netlify-specific question and we can’t help you with how to build a service worker, but you can look for that. If configured correctly, after the initial load, your website can run offline.

Should be a pretty simple search for you:

[your-framework/ssg] cache assets/service worker

Hopefully you will find something useful to help.