function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdcjoeysfdcjoey 

user id of the who accessed vf page

How do i know who all accessed VF page ? I mean how to get the user id of the people who viewed that page
sfdcMonkey.comsfdcMonkey.com
hi
You can make use of global variable to access user id in vf page as {!$User.Id}
For more information please go through https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global_user.htm

If you are trying to access it in your JS function you can do somthing like
<apex:page controller="myController">
<script>
function myJSFunction(){
  alert('{!userid}');
  //your js code
 }


 /** Controller **/
 public with sharing class myController{
    public String userid{get;set;}
    public myController(){
         userid = Userinfo.getUserId();
    }
 
 //your code

 }
Thanks
Mark it Best answer if it helps you :)