Perspective workstation don't run the script on session startup event

I want get the basic parameters from db when I start this session.And I add the scripts on session Startup event, it works well when opened through brower but it can’t work when opened through workstation. So what’s the difference between these two methods

We aren't mind readers. Show the errors/differences you get, and share the script.

Likely cause would be a timeout or persistence where workstation is still keeping the session active and you're just closing and reopening it to do your test whereas the browser closes the connection when closed.

Go to the gateway status and perspective sessions and then close workstation and make sure the workstation session actually closes / disappears. Then try launching it again and see if that changes your situation.