+ Start a Discussion

href re-direction according to user logged in or not



I have a site's VF page in which i have an href attribute pointing towards an url. Without using apex, i want to check this condition in VF when user clicks on the href, If user is logged in send him to google.com else send him to yahoo.com. How can i do this?




There's probably a few ways to do this.  One (slightly clunky) way that I've done it is to use the $User.UserName global variable and check for the name of the site in the string (as the "Guest" user has the name of the site as its username).


I've tended to use this for conditional rendering, but it work okay in javascript.