Monday 15 February 2010

javascript - Grabbing HTML from another page -



javascript - Grabbing HTML from another page -

i have 2 html files: 1 acts template, supplying navigation, sidebars, etc., , other has main content. i'm trying figure out how best insert content template. need persistent urls, plan have content page replace template, plugging text resulting page. i'm new front-end programming , i'm suspicious may anti-pattern, first question whether i'm barking right tree. problem seems universal, , i'm sure there must best practice, though haven't yet seen discussed. if is acceptable way proceed, javascript function allow me access html of 2 different pages @ same time?

[edit: it's little page on github]

do not this. @ current implementation html not designed template engine. can utilize html import has not total back upwards in browsers. (compatibility table).

usually problem can solved with:

use frontend framework. libraries angular.js or polymer.js (and so on) has back upwards of importing html documents in different forms.

build application html. task runners grunt.js has plugin includes html.

use server side technologies extend html base of operations layouts

if application have consisted different htmls recommend seek polymer. polyfill web components , designed work in such way default.

upd:

about edit question. seems need template engine html. can google it. utilize nunjucks - javascript port of python's template engine jinja2. lightweight, simple , can compiled right in browser.

another way utilize special tools building static web pages. have mentioned page blog build simple html pages. seek utilize pelican. static websites (blogs) generator. simple , fast. can build html on local machine , force html pages github.

javascript html

No comments:

Post a Comment