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

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,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.