+ Start a Discussion

Accessing domain name from sites page

How to access the domain name of the salesforce org from the sites page(i.e. if org is https://cs7.salesforce.com,then accessing it from sites page). System.URL.getSalesforceBaseUrl().getHost() didnot provide the proper result.Still we can substring it to get the results.But from sites page,it fails.Donot want to store it in a label and then access it from the controller of the site page.Any idea for retrieving the value dynamically....


Check out the $Site global variable:




This has methods that allow access to the URL, domain etc.


You can use these on a page.