1st remark :
The sample you give does not work if the script element is put inside the <head> element.
2nd remark :
the sample code :
<<var appendTo = document.getElementById('stork-widget');
> appendTo.parentNode.insertBefore(div, appendTo);>>
looks weird to me and is not coherent with the sample given in 2.2.1 :
<<But you can always ask publishers to
> identify the target render location separately using a uniquely identified element:
<body>
<div id="camerastork-widget"/>
Hello, world
<script
> src="http://camerastork.com/widget.js?product=1234"></script>
</body>
In this example, when widget.js loads, it will render the product widget and
append it to the < element div> with id="camerastork-widget".>>
3rd remark :
Listing 3.1 is not coherent with Listing 2.1 on the value for script.src (script.src should always be cross domain ?)
Best regards
Henri d'Orgeval
|