Getting the portal username from javascript

Hi:

There is a function that I can use from a javascript block that returns the current portal username ?

Thanks
Edgardo

You can use this expression in your script block:

var userId = "#{facesContext.externalContext.remoteUser}";