<div dir="ltr">Hey guys..<br><br>I was curious if it&#39;s possible to execute javascript by adding &lt;script&gt; nodes into the head node the same way that &lt;link&gt; nodes are added for CSS styles. I&#39;ve created a method that does it for me locally, but the script in question doesn&#39;t seem to be executing... is there something special needed to make javascript work in this document? Here&#39;s my snippet:<br>
<br>public static void addScriptNodeToHead (VpePageContext pageContext, nsIDOMDocument visualDocument, String scriptSrc) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; nsIDOMNode headNode =&nbsp; pageContext.getVisualBuilder().getHeadNode();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; nsIDOMElement scriptNode = visualDocument.createElement(&quot;script&quot;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; scriptNode.setAttribute(&quot;src&quot;, scriptSrc);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; scriptNode.setAttribute(&quot;type&quot;, &quot;text/javascript&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; headNode.appendChild(scriptNode);<br>&nbsp;&nbsp;&nbsp; }<br></div>