I think that’s pretty much up to each product to support. To be honest I don’t think I know of any that does (it’s easier just to send down all of the content).
Now one thing you can do is to create a context(which you do) and then in your servlet/action/web-panel do the condition there. But to be honest unless you’ve got super secret sensitive javascript code with people’s data you might just want to send it down all the time for your specific context. It will be much friendlier to the end user (they don’t get different javascript urls) and a lot easier to debug.