If I understand your question correctly, simply have your LS agent print the JS to the browser and the browser will execute it. For example:
Related Q&A from Dave Hatter
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.