0

I have a simple Visualforce page with just an Iframe inside.

I want to send as parameter to this Iframe the Instance URL.

To do this I use Global Variables, it is working for other parameters like {!$CurrentPage.parameters.id} or {!$Api.Session_ID} .

{!$Site.BaseUrl} or any other {!$Site.xxx} working only in Force.com site.

How can I get the instance URL from this VisualForce Page?

<apex:page standardcontroller="Case"  showHeader="false" title="PIM" >
baseurl {!$Site.BaseUrl}     name{!$Site.Name}  {!$CurrentPage.parameters.id}  {!$Api.Session_ID}        
<apex:iframe src="anyURL" scrolling="true" id="theIframe"/>
</apex:page>
5
  • You will be able to get values using $Site if the page is running on a Salesforce Site, is your VF page running in that context?
    – Jayant Das
    Commented May 30, 2019 at 13:42
  • Yes , it is a button
    – Raphael D
    Commented May 30, 2019 at 13:45
  • It seems that $Site can be used just in Force.com Site but not from the Org . salesforce.stackexchange.com/questions/67285/…
    – Raphael D
    Commented May 30, 2019 at 14:14
  • That is the question that I sent in my last comment , this the same question but the answer is not complete . I know why $Site not working but now how can I get the instance Url?
    – Raphael D
    Commented May 30, 2019 at 14:22
  • My earlier comment was to indicate if you have the VF page running in the right context or not. That you have found why it is not working, any question out of this question's context will classify as a new question based on the SFSE format. You may like to instead edit this question to provide more details as what you are trying to achieve.
    – Jayant Das
    Commented May 30, 2019 at 14:25

1 Answer 1

1

Sometimes I love Salesforce, sometimes when you want something simple....not so much

{!LEFT(RIGHT($CurrentPage.URL,(LEN($CurrentPage.URL))-8),(FIND('/',(RIGHT($CurrentPage.URL,(LEN($CurrentPage.URL))-8))))-1)}

Not the answer you're looking for? Browse other questions tagged .