Embed

From WidgetAvenue Wiki

Jump to: navigation, search

Widgets powered by the WidgetAvenue platform can run on any web server where Javascript is enabled.

Installation method

  • Copy the following code
  • Replace [Unique Id] by a Unique Id of your choice, which should be different for each web page you install the widget on.
  • Replace [encoded list of your widget prefs] by the relevant widget arg
  • Paste the code inside the body of the html page where you want the widget to be rendered
<!-- [Unique Id] Embed Code -->
<span id="[Unique Id]" >
 Loading <a href="http://www.widgetavenue.com/wdg/loaders/stn.php?[encoded list of your widget prefs]"> widget</a> 
</span>
<script type="text/javascript">
 var script = document.createElement("script");
 var t = new Date();
 script.setAttribute('src','http://www.widgetavenue.com/wdg/loaders/bad_js.php?[encoded list of your widget prefs]&_installid_=[Unique Id]&_nocache_='+ t.getTime());
 destNodeDiv = document.getElementById('[Unique Id]');
 destNodeDiv.parentNode.insertBefore(script, destNodeDiv);
</script>
<!-- end WidgetAvenue Widget -->

For example,using the Hello World widget built here, if your source HTML file is located at http://myserver.com/HelloWorld.html, you will be able to display your widget on a webpage using the following code:

<!-- W123456789 Embed Code -->
<span id="W123456789" >
 Loading <a href="http://www.widgetavenue.com/wdg/loaders/stn.php?root=html&url=http%3A%2F%2Fmyserver.com%2FHelloWorld.html"> widget</a> 
</span>
<script type="text/javascript">
 var script = document.createElement("script");
 var t = new Date();
 script.setAttribute('src','http://www.widgetavenue.com/wdg/loaders/bad_js.php?root=html&url=http%3A%2F%2Fmyserver.com%2FHelloWorld.html&_installid_=W123456789&_nocache_='+ t.getTime());
 destNodeDiv = document.getElementById('W123456789');
 destNodeDiv.parentNode.insertBefore(script, destNodeDiv);
</script>
<!-- end WidgetAvenue Widget -->
Personal tools