ChuckJonas/bad-ass-salesforce-stack

API request don't work when VF page is displayed in lightning

ChuckJonas opened this issue · 0 comments

When the VF page is loaded into lightning, the request stop working because the app is using ?isdtp=p1 gets to the instance url __RESTHOST__.

Fix: update the header to remove extra junk:

const __RESTHOST__ = '{!URLFOR("/", null)}'.replace("?isdtp=p1", "");

Might want to come up with a more robust solution as there might be other URL param/values that get appended