Pages

March 7, 2020

BTBGuide: Javascripts and the Power of Distributed Content




A lot of the dynamic sidebar content I listed in this post, The Joys of the Sidebar, was powered by javascripts: the random cats, books, student advice, videos, projects, 100-words stories — these are all javascripts that display content at random. So, that's dynamic content: each time the page loads, the content is different. (More about how I create those randomizers here: Dynamic Content: Javascript Randomizers.)

In addition to being dynamic content, those javascripts are also distributed content. There is one javascript, and it displays content wherever the javascript is called: in blogs, webpages, wikis, wherever javascripts are allowed. One script, distributed... wherever!

To see what I mean, here's a link to one of those javascript randomizers. This is the 400-pixel wide version of the Mindset Cat. It's a .js (javascript) file in my own webspace as you can see here:https://widgets.lauragibbs.net/gmcats/growth400.js

It's basically a little computer program! (No, I did not write the program myself; I use the free Rotate Content tool to do that for me.) To make the javascript program run, you have to wrap it up in a script call, so this is the actual HTML code you copy-and-paste to make the random cats display:



And here's the script at work; just reload to see more cats at random.



To learn more about these randomizing javascripts, here's a blog I created for a CanInnovate presentation which I made in 2019: Javascript Magic in Canvas. Randomizing Widgets, No Coding Required.

Slides. Here's a link to the Slides file and also a link to the full-screen view.


No comments:

Post a Comment

If the comment form misbehaves, you can also find me at Twitter: @OnlineCrsLady. (Sometimes convos are faster and easier there in fact.)