+ Start a Discussion
Ron WildRon Wild 

Can we determine the URL of the caller on a VF page?

Is it possible to retrieve the url of a caller (a-la HTTP Referrer) on a visualforce page?


We need to be able to differentiate between posts from two different domains to a single visuaforce page.  For example calls from https://test.acme.com would trigger test processing while https://www.acme.com would trigger live processing.




I ran into a similar, albeit slightly different problem recently.  I had a VF page, called from a button on an opportunity list view.  I needed to return the user back to the page in which the VF page was called from -- sometimes this was a list of opportunities on a contact record, sometimes a list of opps on an account record, sometimes a list on an Opps list view.  The Opps list view has different URL parameters, I couldn't just grab an id and reconstruct the return URL in the same manner as I did for an account or contact record.  What I discovered from a coworker was that Salesforce more often than not, throws the URL of the calling page into the query string retUrl parameter and you can grab it there:





EDIT: just noticed that you want the calling URL in the VF page and not in the Apex controller/extension but you can get/set it in your controller assuming you're using a custom controller or extension.

Message Edited by DManelski on 01-26-2009 06:45 AM