New JavaScript HTML5 Report Format

This is a new type of HTML5 report that breaks the normal conventional techniques of generating a HTML page. Instead of using a server programming and template language to generate the HTML on the server, the data is simply embedded as JSON, unaltered inside the tag:

<script id="dto" type="text/json">{jsondto}</script>

Because of the browser behaviour of the script tag, you can embed any markup or javascript unescaped. Unless it has none or a ‘javascript’ type attribute, the browser doesn’t execute it letting you to access the contents with:

document.getElementById('dto').innerHTML

 

New JavaScript HTML5 Report Format

From there, javascript invoked just before the closing body tag (i.e. the fastest time to run DOM-altering javascript) which takes the data, builds up a html string and injects the generated markup in the contents of the page.

Source Website

You may also like...

1 Response

  1. February 17, 2011

    [...] This post was mentioned on Twitter by nuefolio, Nagavardhan Raju. Nagavardhan Raju said: New JavaScript HTML5 Report Format http://lnkd.in/ctJQNM [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>