Can anyone suggest how to detect if we are viewing the Visualforce Page in Home Page or as a separated dedicated custom VF tab?

With now Home Page components being able to be sourced from Visualforce, we can sue same VF page for Home Page Component and can create a VF Tab as well, and so my query is, how can we detect and take actions based on the place where the VF page is being displayed.

Is there a global method or a trick that we can use to determine the context in APEX/Javascript/Visualforce?


In the apex you can use apexpages.currentpage().geturl() and from this string you use Contains method of string to look for the 'home' in the string. If you get home then this vf page is used from the home tab else from the vf tab.

Please, Comment here if you need more inputs!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.