Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fractastical/989773 to your computer and use it in GitHub Desktop.
Save fractastical/989773 to your computer and use it in GitHub Desktop.
@fractastical get full url (including extension)
host = ApexPages.currentPage().getHeaders().get('Host');
Integer startIndex = siteUrl.indexOf(host) + host.length() + 1;
Integer endIndex = siteUrl.lastIndexOf('/');
System.debug('si:' + startIndex + 'ei: ' + endIndex);
if(startIndex < endIndex && startIndex != -1)
extension = siteUrl.substring(startIndex,endIndex);
else
extension = '';
if(extension != 'apex')
testUrl2 = siteUrl.substring(0, startIndex) + extension + System.Page.largeLookup.getUrl();
else
testUrl2 = siteUrl.substring(0, startIndex - 1) + System.Page.largeLookup.getUrl();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment