var el = document.createElement('link'); el.rel = 'stylesheet'; el.type = 'text/css'; el.href = 'http://www.Example.com/...' + 'styles.css'; document.body.appendChild(el);I think they code it this way so people using their HTML5 slide template don't have to include a bunch of extra css files, just this one JavaScript file. If people get the file dynamically from Google all the time, Google can change the styles without breaking people's links. It's just one less dependency.
I'm blogging about programming, but ... hey look over there - it's something shiny!
Tuesday, December 27, 2011
Dynamically Adding a Style Sheet
I've been looking at some of Google's code for their Html5Slides project and like the way they dynamically link in a style sheet:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment