I’m only going to be able to get each site that wants my widget, to copy and paste the code block in once..
So it needs to be really future proof.
I’ve thought about this for a while and this is the widget code i’ve come up with :
<script type="text/javascript" src="http://www.mydomain.com/my-future-proof-widget.js"></script>
<div id="mywidget"></div>
would this be the best plan?
could this create any limitations?
any other thoughts on widgetry?!
I wouldn’t add the
<div id="mywidget"></div>to the code, since future experimentation may suggest alternate containers / layouts, etc. Instead, I’d provide a setup function in my script that accepted an id or a node.So the setup script might look something more like this:
The use of an
init()function also lets people add your widget to dynamically generated code, or create it in response to a user’s activity more easily. If it runs the minute it loads then it greatly limits people’s options.