1

I'm writing a web application / UI for a game that's done purely in HTML. A lot of things are in common like the top bar, menu bar, pop-up friends UI and the like. Normally, something like this is done with server-side includes? I've heard document.write is inherently evil - so what's the options client sided?

4

1 回答 1

0

There are a few ways you could do this:

  1. Client-side Templating - check out Moustache and Handlebars

  2. AJAX - You could load the header/footer asynchronously and render them around your content (or vice-versa, create your site as a single-page application, loading the wrapper first, then loading the page content asynchronously and inserting that into the wrapper).

  3. iFrames / Framesets - Old-school, but it will do what you want, more or less.

于 2013-06-14T01:51:03.860 回答