JavaScript control agent