+ Start a Discussion
Francesco SciutoFrancesco Sciuto 

How to retrieve Site.BaseURL from JavaScript

I have an object layout displayed as a tab inside Sales Console. I have some Javascript attached to the onClick event of a button on the layout. In the Javascript I would like to retrieve the Base URL displayed in the browser. So if I have 'https://[instancenumber].salesforce.com/console' I would like to get 'https://[instancenumber].salesforce.com'. I use within Javascript:


but I always get NaN. I know that I might use Javascript directly but I would like to know why this Salesforce approach does not work and I can make it work. Thanks
Renato SoluRenato Solu
The correct use is:
because the tag gets replaced by the actual content, and strings in JS need to be wrapped with simple quotes.
Srini GrandhiSrini Grandhi
It did not work for me.