Hey Lloyd,
This may give you a clue:
Execute JavaScript in Browser Actions – Best Practices
-Chris
For more information, see the wiki Searching the Forum for Answers section.