0

I'm currently building a website using the service provided by github with gh-pages.

Since it is possible to download the repository as a zip package, i'm trying to figure out a good way to include header, footer and other stuff into the different pages I'm about to write for an offline browsing supported by at least the more common browsers such us chrome, safari and firefox.

The website builded this way should be rendered only by the browser, so php, ssi etc don't fit the need.

Jquery seems to be a good way (of course given that i provide the needed scripts in the repo to download), but i am having some issues with chrome which encounter a permission denied error handling a localhost file retrivial.

So in which smart way can i include an HTML file into another one?

Maxiride
  • 187
  • 8
  • I think an ajax method could work as explained here http://www.dynamicdrive.com/dynamicindex17/ajaxincludes.htm however the simple jquery $(#id).load(file) was more straightforward. – Maxiride Apr 23 '15 at 06:53
  • After further research I found this net script http://johannburkard.de/blog/programming/javascript/inc-a-super-tiny-client-side-include-javascript-jquery-plugin.html which works like a charm, however the nested menu included in such way isn't modified by another jquery script that handles hide\show css function. Why? – Maxiride Apr 23 '15 at 12:53

2 Answers2

0

I'm sure you will be pleased by Jekyll static site generator

David Jacquel
  • 51,670
  • 6
  • 121
  • 147
  • That's not a viable way, because if all the files are downloaded locally the website will not be rendered just using a browser to open index.html. A local install of jekyll would be needed. And what I aim to do is a downloadable website which is usable offline just with a browser. Thanks anyway for the hint even if I already knew jekyll and it's setup. – Maxiride Apr 23 '15 at 18:28
  • And Jekyll, the Octopress way. Generate locally, automatically push code in one branch, generated website in an other. Just do a release on github and your generated website can be downloaded as a zip and fully functional on a file system. http://octopress.org/ – David Jacquel Apr 23 '15 at 18:39
  • I'll read more about octopress, thanks! However how could a browser interpret liquid formatting and YAML code on it's own? – Maxiride Apr 23 '15 at 18:58
  • With octopress you have the code in one branch and the generated result in one other, all come from you local build. You customer only have to download the generated result and it will play nearly well offline, because of the resources path that can be tricky to setup. – David Jacquel Apr 23 '15 at 19:11
0

This may possibly help. HTML5 is starting to support offline pages/applications.

See http://updates.html5rocks.com/2015/02/offline-first-with-sw-precache

and http://googlechrome.github.io/sw-precache/

This is currently only available in Chrome Canary and Firefox nightly but offline support is becoming a standard in w3c. See http://www.w3.org/TR/service-workers/

Ralph Yozzo
  • 1,086
  • 13
  • 25