I wanted to add this javascript to the head of the page: 

<script src="//platform.linkedin.com/in.js" type="text/javascript">
     api_key: <secret key>

My solution was to put this code on a resource:

var head= document.getElementsByTagName('head')[0];
   var script= document.createElement('script');
   script.type= 'text/javascript';
   script.src= '//platform.linkedin.com/in.js';
   script.innerHTML = "\napi_key: <secret key>\n";

Then I used the action AddJavaScriptTag to use this resource.

There are better ways to do this?

not really, but why in the head?

just add it as an expression in the page or layout-webblock) ?

Because at the time that wasn't working and i thought it could be because it wasn't on head. To connect to LinkedIn is enough to put as expression on the page. But if the problem was to put something like that on the head how would u do it? 


you might want to checkout IncludeJavascript_API

and especially Script_CreateOrUpdate


Hi, this has actually helped to answer a question I had a few weeks ago... however I notice that these actions will apply the Script to every application in the environment even though they have only been added to one eSpace.

Does anyone know if similar actions are available which will only add the scripts to the application the actions are included in, and not all apps in the environment?