There's no easy way to establish a new connection between firefox and the running script AFAIK.
I also don't believe it would be possible/wise trying to change the behaviour of firefox,
although you could write your own webbrowser for the client's side...
I think you'll need something like session cookies and persistent session data storage.