Problem is, in sandboxed solutions you are not allowed to put files into _layouts, and it is not possible to reference Assets files using
What else is available to us? Actually, there is one thing – you can use
<CustomAction Location="ScriptLink" ScriptBlock="alert('hello');" Sequence="100">
- Create new Sharepoint 2010 solution.
- To keep things simple, put there
alert("Test file loaded!");
- Now it is time to add
Update: You can actually use
ScriptBlock and it will work like in _layouts.
Notice ~site token inside
ScriptBlock. It will be replaced with the server relative url of the current site (SPWeb). Another available token is ~sitecollection, which gives server relative url of current site collection (SPSite). It is useful, if you are deploying your feature to site scope.