You need to sign in to do that
Don't have an account?
FSamorgan
How to compose URLs in Communities Visualforce page
I have a Visualforce page that has javascript that creates urls as var url = '/' + obj.Id; this works fine when accessed in the normal Salesforce context but when this Visualforce page is accessed from a community then the url no longer works. This is because it expects the url to be var url = '/mycommunity/' + obj.Id;
I cannot use the typical solution {!URLFOR()} because the objects are being pulled via Javascript Remoting. Is there a way via Apex or preferrably Javascript to know the community name (if present)? So I can do var url = '/'; if (isCommunity) url += communityName + '/' ; url += obj.Id;
I need a solution that works both in and out of a community using the same Visualforce page.
I cannot use the typical solution {!URLFOR()} because the objects are being pulled via Javascript Remoting. Is there a way via Apex or preferrably Javascript to know the community name (if present)? So I can do var url = '/'; if (isCommunity) url += communityName + '/' ; url += obj.Id;
I need a solution that works both in and out of a community using the same Visualforce page.
If you are trying to redirect then you can try this once -
Thanks,
Dhanya
All Answers
then you could use the "location.origin" to set your criteria
If you are trying to redirect then you can try this once -
Thanks,
Dhanya
Thanks Dhanya, that works for me.