7

I want to make my website available offline even if the user clears the cache and cookies. Is is possible? Also I am dealing with database. Is is possible to handle databases offline?

Yi Jiang
  • 49,435
  • 16
  • 136
  • 136
rdp
  • 2,072
  • 4
  • 31
  • 55
  • I am thinking of using web sql database but it needs support of sqllite. Is it possible to use mysql at server side, and sqlite at cleint side. – rdp Feb 02 '11 at 08:23

6 Answers6

11
  1. A user could store a local copy of a single webpage using Chrome (right click save-as) and it will store all resources (images, css, js) required to fully load the page offline. Other browsers will have similar options.

  2. You can use wget to mirror a whole website for offline browsing.

    wget --mirror --convert-links --html-extension -p http://www.example.com/
    

    of course neither of these options will handle database driven elements of your site/page.

  3. If you want to mock a database or dynamic elements of a page offline then Google Gears is probably the closest to what you are looking for but I think it was deprecated by Google last year.

Yi Jiang
  • 49,435
  • 16
  • 136
  • 136
Joel
  • 29,538
  • 35
  • 110
  • 138
  • Google Gears is no longer available, but it's still possible to make websites available offline [using Service Workers](https://developers.google.com/web/ilt/pwa/caching-files-with-service-worker). – Anderson Green Feb 10 '22 at 21:00
7

If your users have modern browsers, try HTML5 Application Cache.

References:

Overview - http://www.html5rocks.com/en/features/offline

Demo - https://jonathanstark.com/labs/app-cache-7/

Tutorial - https://www.html5rocks.com/en/tutorials/appcache/beginner/

Article - http://grinninggecko.com/developing-cross-platform-html5-offline-app-1/

jpillora
  • 5,194
  • 2
  • 44
  • 56
2

Summary: Click me, I'm the newish thing that browsers now support!

I clicked some of the links found in other answers, and all tools mentioned are deprecated or will/should be soon.

Later when I wasn't connected to the internet, I opened a site operated by Google (either Google Docs or YouTube, I sadly forgot since then) and went to view the page source, as I was curious to see other answers in action. I found something called ORIGIN-TRIAL in the manifest file. After a quick Google search, I found this, which brought me to this, which somehow brought me to the last link:

https://developers.google.com/web/fundamentals/primers/service-workers

In conclusion, use Service Workers now. If you're curious if it now works with all browsers, don't worry. All popular browsers should support it as seen here.

Xan
  • 21
  • 1
  • 3
0

You can use simple command to download whole website locally with all links working properly.

wget -rk 'http://www.website.com'

For https url you need to add one more property like below :

wget -rk --no-check-certificate 'https://www.website.com'
Ravindra Bhalothia
  • 1,720
  • 2
  • 13
  • 16
0

No, if your databases are housed online. then you need a internet connection for the PHP/ASP (whatever you're using to deal with DBs) to connect/communicate to the DB's

benhowdle89
  • 36,900
  • 69
  • 202
  • 331
  • (I know this is an old answer, but I make a comment for other user who read this..) Even thought your web app / homepage are create with serverside technologies like php or asp, its still possible to use some of the techniques in the other answers to have an offline model, especially with html5. But there are no "direct" (without work) way to do it. (The database part, need some method for sync when the device come online again, so it can be a tricky thing to do, and there are off cause not live updating, if there are no internet connection!) – Alf Nielsen Nov 08 '16 at 14:13
0

For storing data locally and accessing them offline take a look at Gears and Web Storage.

The main problem is what degree of functionality you want to provide with your website. It always requires some work on the client (user) side to "store" aka. save your website offline. You would have to store all your functionality in one page that the user stores (be it a Flash movie or some Javascript-Code).

initall
  • 2,385
  • 19
  • 27